How to initialize a resource #406
-
Discord user IDNo response Describe your question in detail.struct ResourceProviders has key {
i want the function to move to the fixed address RESOURCE_ACCOUNT_ADDR . how to do it What error, if any, are you getting?No response What have you tried or looked at? Or how can we reproduce the error?No response Which operating system are you using?Windows Which SDK or tool are you using? (if any)TypeScript SDK Describe your environment or tooling in detailNo response |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
You can create an object with |
Beta Was this translation helpful? Give feedback.
-
If you're using objects, like @ajaythxkur mentioned, you need the object signer. Objects are an upgrade on resource accounts, so this is recommended. let constructor_ref = object::create_named_object(master, OBJECT_NAME);
let object_signer = object::generate_signer(&constructor_ref);
let extend_ref = object::generate_extend_ref(&constructor_ref);
move_to(&object_signer, ResourceProviders { providers: vector::empty() });
move_to(&object_signer, ObjectController { extend_ref }); If you're using resource accounts, you need the resource account signer capability. move_to(&resource_acc_signer, ResourceProviders { providers: vector::empty() }); |
Beta Was this translation helpful? Give feedback.
If you're using objects, like @ajaythxkur mentioned, you need the object signer. Objects are an upgrade on resource accounts, so this is recommended.
If you're using resource accounts, you need the resource account signer capability.