transferContractOwnership
Transfers ownership of a given contractId to an intended ownerId, must be called by current owner
transferContractOwnership
takes a single argument of type TransferContractOwnershipArgs
export type TransferContractOwnershipArgs = {
//id of the contract for which the ownership will be transfered
contractAddress: string;
//intended owner of the contract
nextOwner: string;
options?: {
//keep the current minters, defaults to true if options aren't given
keepMinters: boolean;
};
};
Example usage of
transferContractOwnership
method in a hypothetical React component:TransferContractOwnershipComponent.ts
1
import { useState } from 'react';
2
import { useWallet } from '@mintbase-js/react';
3
import { execute, transferContractOwnership, TransferContractOwnershipArgs } from '@mintbase-js/sdk';
4
5
6
export const TransferContractOwnershipComponent = ({ nextOwner, contractAddress }: TransferContractOwnershipArgs): JSX.Element => {
7
const { selector } = useWallet();
8
const handletransferContractOwnership = async (): Promise<void> => {
9
const wallet = await selector.wallet();
10
await execute(
11
{wallet},
12
transferContractOwnership({
13
contractAddress: contractAddress;
14
nextOwner: nextOwner;
15
}),
16
)
17
};
18
return (
19
<div>
20
<button onClick={handletransferContractOwnership}>
21
transferContractOwnership for {contractAddress} to {nextOwner}
22
</button>
23
</div>
24
);
25
};
Last modified 10mo ago