OffChainList
Class: OffChainList
Properties overview
- root: Field = Field; ↗
- storage: Storage = Storage; ↗
- Overrides: Struct({
/ The root hash of the Merkle tree representing the whitelist. /
root: Field,
/ Off-chain storage information, typically an IPFS hash pointing to the whitelist data. /
storage: Storage,
}).empty ↗
Methods overview
Defined in: packages/storage/src/whitelist/offchain-map.ts:177
Extends
- {
root
:Field
;
storage
:Storage
;
}
Constructors
new OffChainList()
new OffChainList(value: {
root: Field;
storage: Storage;
}): OffChainList
Defined in: node_modules/o1js/dist/node/lib/provable/types/struct.d.ts:103
Parameters
value
root
Field
= Field
The root hash of the Merkle tree representing the whitelist.
storage
Storage
= Storage
Off-chain storage information, typically an IPFS hash pointing to the whitelist data.
Returns
Inherited from
Struct({
/ The root hash of the Merkle tree representing the whitelist. /
root: Field,
/ Off-chain storage information, typically an IPFS hash pointing to the whitelist data. /
storage: Storage,
}).constructor
Properties
root
root: Field = Field;
Defined in: packages/storage/src/whitelist/offchain-map.ts:179
The root hash of the Merkle tree representing the whitelist.
Inherited from
Struct({
/ The root hash of the Merkle tree representing the whitelist. /
root: Field,
/ Off-chain storage information, typically an IPFS hash pointing to the whitelist data. /
storage: Storage,
}).root
storage
storage: Storage = Storage;
Defined in: packages/storage/src/whitelist/offchain-map.ts:181
Off-chain storage information, typically an IPFS hash pointing to the whitelist data.
Inherited from
Struct({
/ The root hash of the Merkle tree representing the whitelist. /
root: Field,
/ Off-chain storage information, typically an IPFS hash pointing to the whitelist data. /
storage: Storage,
}).storage
Methods
getValue()
getValue(key: Field, name: undefined | string): Promise<FieldOption>
Defined in: packages/storage/src/whitelist/offchain-map.ts:228
The function fetches a whitelisted amount associated with a given key using a map and returns it
as a FieldOption.
Parameters
key
Field
The key
parameter is of type Field
,
which represents a field element in the context of a cryptographic system.
name
undefined
| string
Returns
Promise
<FieldOption
>
The getValue
function returns a Promise
that resolves to a FieldOption
object. This object contains a value
property representing the amount retrieved from a map based
on the provided key. The isSome
property indicates whether the value is present or not.
The value is not present if the list is NOT empty and the key is NOT in the map.
The value is present if the list IS empty or the key IS in the map.
The value is present and equals to Field(0) if the list IS empty.
isNone()
isNone(): Bool
Defined in: packages/storage/src/whitelist/offchain-map.ts:183
Returns
Bool
isSome()
isSome(): Bool
Defined in: packages/storage/src/whitelist/offchain-map.ts:187
Returns
Bool
load()
load(name: undefined | string): Promise<OffchainMapOption>
Defined in: packages/storage/src/whitelist/offchain-map.ts:191
Parameters
name
undefined
| string
Returns
Promise
<OffchainMapOption
>
toString()
toString(): string
Defined in: packages/storage/src/whitelist/offchain-map.ts:326
Returns a string representation of an object.
Returns
string
create()
static create(params: {
attempts: number;
auth: string;
data: object;
filename: string;
json: OffchainMapSerialized;
keyvalues: object;
list: | OffChainMapEntry[]
| {
key: string;
value: number;
}[];
name: string;
pin: boolean;
timeout: number;
}): Promise<{
json: OffchainMapSerialized;
list: OffChainList;
}>
Defined in: packages/storage/src/whitelist/offchain-map.ts:256
Creates a new OffchainList
and pins it to IPFS.
Parameters
params
The parameters for creating the list.
attempts
number
auth
string
data
object
The JSON data that should be added to the IPFS storage that represent the initial data
filename
string
json
keyvalues
object
list
| OffChainMapEntry
[]
| {
key
: string
;
value
: number
;
}[]
The list of entries to be added to the map.
name
string
pin
boolean
timeout
number
Returns
Promise
<{
json
: OffchainMapSerialized
;
list
: OffChainList
;
}>
A new OffChainList
instance.
empty()
static empty(): OffChainList
Defined in: packages/storage/src/whitelist/offchain-map.ts:241
Returns
Overrides
Struct({
/ The root hash of the Merkle tree representing the whitelist. /
root: Field,
/ Off-chain storage information, typically an IPFS hash pointing to the whitelist data. /
storage: Storage,
}).empty
fromString()
static fromString(str: string): OffChainList
Defined in: packages/storage/src/whitelist/offchain-map.ts:334
Parameters
str
string
Returns
Updated 10 days ago