The Core module is the main entry point for the library.
Create a new actor manager with the given options.
Its create a new agent manager if not provided.
const { queryCall, updateCall, getPrincipal, login } = createReactorCore<Candid>({ canisterId, idlFactory, withProcessEnv:true, // will use process.env.DFX_NETWORK })
You can find All available methods are returned from the createReactorCore function here.
// later in your code awaitlogin({ onSuccess: () => { console.log("Logged in successfully") }, onError: (error) => { console.error("Failed to login:", error) }, })
// queryCall, will automatically call and return a promise with the result const { dataPromise, call } = queryCall({ functionName:"icrc1_balance_of", args: [{ owner:getPrincipal(), subaccount: [] }], })
console.log(awaitdataPromise)
// updateCall const { call, subscribe } = updateCall({ functionName:"icrc1_transfer", args: [ { to: { owner:getPrincipal(), subaccount: [] }, amount:BigInt(10000000000), fee: [], memo: [], created_at_time: [], from_subaccount: [], }, ], }) // subscribe to the update call subscribe(({ loading, error, data }) => { console.log({ loading, error, data }) })
The Core module is the main entry point for the library. Create a new actor manager with the given options. Its create a new agent manager if not provided.
Example
You can find All available methods are returned from the
createReactorCore
function here.