-
Notifications
You must be signed in to change notification settings - Fork 11.6k
Open
Labels
doc-issueIssue submitted using the Doc issue templateIssue submitted using the Doc issue template
Description
I'm going through the Weather Oracle example, and the explanation doesn't match with the code sample in the Weather Oracle Module.
fun init(otw: WEATHER, ctx: &mut TxContext) {
package::claim_and_keep(otw, ctx); // Claim ownership of the one-time witness and keep it
let cap = AdminCap { id: object::new(ctx) }; // Create a new admin capability object
transfer::share_object(WeatherOracle {
id: object::new(ctx),
address: ctx.sender(),
name: b"SuiMeteo".to_string(),
description: b"A weather oracle.".to_string(),
});
transfer::public_transfer(cap, ctx.sender()); // Transfer the admin capability to the sender.
}
- The
init
function creates and sends thePublisher
andAdminCap
objects to the sender.
Is the Publisher
capability implicitly passed to the sender? Or does it have to transferred with something like:
let pub_cap = package::claim_and_keep(otw, ctx);
transfer::public_transfer(pub_cap, ctx.sender());
Metadata
Metadata
Assignees
Labels
doc-issueIssue submitted using the Doc issue templateIssue submitted using the Doc issue template