Whitelist
Class: Whitelist
Properties overview
Methods overview
- getWhitelistedAmount() ↗
- isNone() ↗
- isSome() ↗
- load() ↗
- toString() ↗
- create() ↗
- empty() ↗
- fromString() ↗
Defined in: packages/storage/src/whitelist/whitelist.ts:15
Extends
- {
list
:OffChainList
;
}
Constructors
new Whitelist()
new Whitelist(value: {
list: OffChainList;
}): Whitelist
Defined in: node_modules/o1js/dist/node/lib/provable/types/struct.d.ts:103
Parameters
value
list
OffChainList
= OffChainList
Returns
Inherited from
Struct({
list: OffChainList,
}).constructor
Properties
list
list: OffChainList = OffChainList;
Defined in: packages/storage/src/whitelist/whitelist.ts:16
Inherited from
Struct({
list: OffChainList,
}).list
Methods
getWhitelistedAmount()
getWhitelistedAmount(address: PublicKey, name: string): Promise<UInt64Option>
Defined in: packages/storage/src/whitelist/whitelist.ts:42
The function fetches a whitelisted amount associated with a given address using a map and returns it
as a UInt64Option.
Parameters
address
PublicKey
The address
parameter is of type PublicKey
,
used to retrieve a whitelisted amount for the given address.
name
string
= "whitelist"
Returns
Promise
<UInt64Option
>
The fetchWhitelistedAmount
function returns a Promise
that resolves to a UInt64Option
object. This object contains a value
property representing the amount retrieved from a map based
on the provided address. The isSome
property indicates whether the value is present or not.
The value is not present if the whitelist is NOT empty and the address is NOT whitelisted.
The value is present if the whitelist is NOT empty or the address IS whitelisted.
The value is present and equals to UInt64.MAXINT() if the whitelist IS empty.
isNone()
isNone(): Bool
Defined in: packages/storage/src/whitelist/whitelist.ts:18
Returns
Bool
isSome()
isSome(): Bool
Defined in: packages/storage/src/whitelist/whitelist.ts:22
Returns
Bool
load()
load(): Promise<OffchainMapOption>
Defined in: packages/storage/src/whitelist/whitelist.ts:26
Returns
Promise
<OffchainMapOption
>
toString()
toString(): string
Defined in: packages/storage/src/whitelist/whitelist.ts:132
Returns a string representation of an object.
Returns
string
create()
static create(params: {
attempts: number;
auth: string;
filename: string;
json: OffchainMapSerialized;
keyvalues: object;
list: WhitelistedAddress[];
name: string;
pin: boolean;
timeout: number;
}): Promise<{
json: OffchainMapSerialized;
whitelist: Whitelist;
}>
Defined in: packages/storage/src/whitelist/whitelist.ts:69
Creates a new whitelist and pins it to IPFS.
Parameters
params
The parameters for creating the whitelist.
attempts
number
auth
string
filename
string
json
keyvalues
object
list
name
string
pin
boolean
timeout
number
Returns
Promise
<{
json
: OffchainMapSerialized
;
whitelist
: Whitelist
;
}>
A new Whitelist
instance.
empty()
static empty(): Whitelist
Defined in: packages/storage/src/whitelist/whitelist.ts:58
Returns
Overrides
Struct({
list: OffChainList,
}).empty
fromString()
static fromString(str: string): Whitelist
Defined in: packages/storage/src/whitelist/whitelist.ts:136
Parameters
str
string
Returns
Updated 10 days ago