You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
while testing program, getting following error.
CMD: anchor test
ErrorLog:
0 passing (10s)
1 failing
blindbox
Is initialized!:
Error: User defined types not provided
at Function.fieldLayout (node_modules/@project-serum/anchor/dist/cjs/coder/idl.js:96:31)
at typeDef.type.fields.map (node_modules/@project-serum/anchor/dist/cjs/coder/idl.js:126:36)
at Array.map ()
at Function.typeDefLayout (node_modules/@project-serum/anchor/dist/cjs/coder/idl.js:125:54)
at AccountsCoder.idl.accounts.map (node_modules/@project-serum/anchor/dist/cjs/coder/accounts.js:20:46)
at Array.map ()
at new AccountsCoder (node_modules/@project-serum/anchor/dist/cjs/coder/accounts.js:19:38)
at new Coder (node_modules/@project-serum/anchor/dist/cjs/coder/index.js:32:25)
at new Program (node_modules/@project-serum/anchor/dist/cjs/program/index.js:54:23)
at fs.readdirSync.forEach (node_modules/@project-serum/anchor/dist/cjs/workspace.js:71:44)
at Array.forEach ()
at Object.get (node_modules/@project-serum/anchor/dist/cjs/workspace.js:64:39)
at Context.it (tests/blindbox.js:16:38)
at processImmediate (internal/timers.js:443:21)
After debugging I've found following struct is causing issue.
IDL json formatt: { "name": "Boxes", "type": { "kind": "struct", "fields": [ { "name": "authority", "type": "publicKey" }, { "name": "boxes", "type": { "defined": "HashMap<u32,NftBox>" } } ] } }
okay @armaniferrante can you please tell what collections are implemented from std::collections as I need to store key-value data in my program ?
or please suggest me any for this purpose.
Trying to understand @armaniferrante
For example:
I want to store n number of Boxes in my account where each Box is a kind of NFT and identified by its ID.
so how will an PDA will store these all n number of Boxes.
OR
are you saying I'll need n number of PDAs to store 1 Box per PDA.
As for now what I can understand one PDA/account can store only one Box, due to the unavailability of map.
while testing program, getting following error.
CMD:
anchor test
ErrorLog:
0 passing (10s)
1 failing
blindbox
Is initialized!:
Error: User defined types not provided
at Function.fieldLayout (node_modules/@project-serum/anchor/dist/cjs/coder/idl.js:96:31)
at typeDef.type.fields.map (node_modules/@project-serum/anchor/dist/cjs/coder/idl.js:126:36)
at Array.map ()
at Function.typeDefLayout (node_modules/@project-serum/anchor/dist/cjs/coder/idl.js:125:54)
at AccountsCoder.idl.accounts.map (node_modules/@project-serum/anchor/dist/cjs/coder/accounts.js:20:46)
at Array.map ()
at new AccountsCoder (node_modules/@project-serum/anchor/dist/cjs/coder/accounts.js:19:38)
at new Coder (node_modules/@project-serum/anchor/dist/cjs/coder/index.js:32:25)
at new Program (node_modules/@project-serum/anchor/dist/cjs/program/index.js:54:23)
at fs.readdirSync.forEach (node_modules/@project-serum/anchor/dist/cjs/workspace.js:71:44)
at Array.forEach ()
at Object.get (node_modules/@project-serum/anchor/dist/cjs/workspace.js:64:39)
at Context.it (tests/blindbox.js:16:38)
at processImmediate (internal/timers.js:443:21)
After debugging I've found following struct is causing issue.
IDL json formatt:
{ "name": "Boxes", "type": { "kind": "struct", "fields": [ { "name": "authority", "type": "publicKey" }, { "name": "boxes", "type": { "defined": "HashMap<u32,NftBox>" } } ] } }
#[account]
pub struct Boxes {
pub authority: Pubkey,
pub boxes: HashMap<u32, NftBox>,
} `
Note: I've also tried
BTreeMap
instead ofHashMap
but getting same issue.Please help me
The text was updated successfully, but these errors were encountered: