Skip to content

Commit

Permalink
Merge branch 'TOOL-360-add-token-management-controller' into TOOL-365…
Browse files Browse the repository at this point in the history
…-add-transfers-controller
  • Loading branch information
danielailie committed Nov 18, 2024
2 parents 1643a52 + 266fdb3 commit 4852ab7
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 18 deletions.
6 changes: 3 additions & 3 deletions src/abi/interaction.local.net.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ describe("test smart contract interactor", function () {

const transactionCompletionAwaiter = new TransactionWatcher({
getTransaction: async (hash: string) => {
return await provider.getTransaction(hash, true);
return await provider.getTransaction(hash);
},
});

Expand Down Expand Up @@ -406,7 +406,7 @@ describe("test smart contract interactor", function () {

const transactionCompletionAwaiter = new TransactionWatcher({
getTransaction: async (hash: string) => {
return await provider.getTransaction(hash, true);
return await provider.getTransaction(hash);
},
});

Expand Down Expand Up @@ -600,7 +600,7 @@ describe("test smart contract interactor", function () {

const transactionCompletionAwaiter = new TransactionWatcher({
getTransaction: async (hash: string) => {
return await provider.getTransaction(hash, true);
return await provider.getTransaction(hash);
},
});

Expand Down
2 changes: 1 addition & 1 deletion src/abi/smartContract.local.net.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe("test on local testnet", function () {

watcher = new TransactionWatcher({
getTransaction: async (hash: string) => {
return await provider.getTransaction(hash, true);
return await provider.getTransaction(hash);
},
});
});
Expand Down
2 changes: 1 addition & 1 deletion src/abi/smartContractResults.local.net.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe("fetch transactions from local testnet", function () {
({ alice } = await loadTestWallets());
watcher = new TransactionWatcher({
getTransaction: async (hash: string) => {
return await provider.getTransaction(hash, true);
return await provider.getTransaction(hash);
},
});
});
Expand Down
2 changes: 1 addition & 1 deletion src/testutils/contractController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class ContractController {
this.provider = provider;
this.transactionCompletionAwaiter = new TransactionWatcher({
getTransaction: async (hash: string) => {
return await provider.getTransaction(hash, true);
return await provider.getTransaction(hash);
},
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/testutils/networkProviders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function createMainnetProvider(): INetworkProvider {
export interface INetworkProvider {
getNetworkConfig(): Promise<INetworkConfig>;
getAccount(address: IAddress): Promise<IAccountOnNetwork>;
getTransaction(txHash: string, withProcessStatus?: boolean): Promise<TransactionOnNetwork>;
getTransaction(txHash: string): Promise<TransactionOnNetwork>;
getTransactionStatus(txHash: string): Promise<ITransactionStatus>;
sendTransaction(tx: Transaction): Promise<string>;
simulateTransaction(tx: Transaction): Promise<any>;
Expand Down
6 changes: 5 additions & 1 deletion src/tokenManagement/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export type MintInput = {
uris: string[];
};
export type ManagementInput = { user: IAddress; tokenIdentifier: string };
export type PausingInput = { tokenIdentifier: string };
export type LocalBurnInput = { tokenIdentifier: string; supplyToBurn: bigint };
export type LocalMintInput = { tokenIdentifier: string; supplyToMint: bigint };

Expand All @@ -59,6 +60,8 @@ export type UpdateQuantityInput = UpdateInput & { quantity: bigint };

export type UpdateInput = { tokenIdentifier: string; tokenNonce: bigint };
export type BurnRoleGloballyInput = { tokenIdentifier: string };
export type UpdateTokenIDInput = { tokenIdentifier: string };
export type ChangeTokenToDynamicInput = { tokenIdentifier: string };

export type RegisterRolesInput = {
tokenName: string;
Expand All @@ -81,12 +84,13 @@ export type RegisterMetaESDTInput = {
};

export type ModifyRoyaltiesInput = BaseInput & { newRoyalties: bigint };
export type ModifyCreatorInput = BaseInput;

export type BaseInput = { tokenIdentifier: string; tokenNonce: bigint };

export type SetNewUriInput = BaseInput & { newUris: string[] };

export type UpdateMetadataInput = {
export type ManageMetadataInput = {
tokenIdentifier: string;
tokenNonce: bigint;
newTokenName?: string;
Expand Down
4 changes: 2 additions & 2 deletions src/tokenManagement/tokenManagementController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ export class TokenManagementController {
async createTransactionForPausing(
sender: IAccount,
nonce: bigint,
options: resources.ManagementInput,
options: resources.PausingInput,
): Promise<Transaction> {
const transaction = this.factory.createTransactionForPausing(sender.address, options);

Expand All @@ -298,7 +298,7 @@ export class TokenManagementController {
async createTransactionForUnpausing(
sender: IAccount,
nonce: bigint,
options: resources.ManagementInput,
options: resources.PausingInput,
): Promise<Transaction> {
const transaction = this.factory.createTransactionForUnpausing(sender.address, options);

Expand Down
14 changes: 7 additions & 7 deletions src/tokenManagement/tokenManagementTransactionsFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ export class TokenManagementTransactionsFactory {
}).build();
}

createTransactionForPausing(sender: IAddress, options: resources.ManagementInput): Transaction {
createTransactionForPausing(sender: IAddress, options: resources.PausingInput): Transaction {
const dataParts = ["pause", ...this.argSerializer.valuesToStrings([new StringValue(options.tokenIdentifier)])];

return new TransactionBuilder({
Expand All @@ -383,7 +383,7 @@ export class TokenManagementTransactionsFactory {
}).build();
}

createTransactionForUnpausing(sender: IAddress, options: resources.ManagementInput): Transaction {
createTransactionForUnpausing(sender: IAddress, options: resources.PausingInput): Transaction {
const dataParts = [
"unPause",
...this.argSerializer.valuesToStrings([new StringValue(options.tokenIdentifier)]),
Expand Down Expand Up @@ -598,7 +598,7 @@ export class TokenManagementTransactionsFactory {
}).build();
}

createTransactionForModifyingCreator(sender: IAddress, options: resources.BaseInput): Transaction {
createTransactionForModifyingCreator(sender: IAddress, options: resources.ModifyCreatorInput): Transaction {
const dataParts = [
"ESDTModifyCreator",
...this.argSerializer.valuesToStrings([
Expand All @@ -617,7 +617,7 @@ export class TokenManagementTransactionsFactory {
}).build();
}

createTransactionForUpdatingMetadata(sender: IAddress, options: resources.UpdateMetadataInput): Transaction {
createTransactionForUpdatingMetadata(sender: IAddress, options: resources.ManageMetadataInput): Transaction {
const dataParts = [
"ESDTMetaDataUpdate",
...this.argSerializer.valuesToStrings([
Expand All @@ -641,7 +641,7 @@ export class TokenManagementTransactionsFactory {
}).build();
}

createTransactionForMetadataRecreate(sender: IAddress, options: resources.UpdateMetadataInput): Transaction {
createTransactionForMetadataRecreate(sender: IAddress, options: resources.ManageMetadataInput): Transaction {
const dataParts = [
"ESDTMetaDataRecreate",
...this.argSerializer.valuesToStrings([
Expand All @@ -667,7 +667,7 @@ export class TokenManagementTransactionsFactory {

createTransactionForChangingTokenToDynamic(
sender: IAddress,
options: resources.BurnRoleGloballyInput,
options: resources.ChangeTokenToDynamicInput,
): Transaction {
const dataParts = [
"changeToDynamic",
Expand All @@ -684,7 +684,7 @@ export class TokenManagementTransactionsFactory {
}).build();
}

createTransactionForUpdatingTokenId(sender: IAddress, options: resources.BurnRoleGloballyInput): Transaction {
createTransactionForUpdatingTokenId(sender: IAddress, options: resources.UpdateTokenIDInput): Transaction {
const dataParts = [
"updateTokenID",
...this.argSerializer.valuesToStrings([new StringValue(options.tokenIdentifier)]),
Expand Down
2 changes: 1 addition & 1 deletion src/transaction.local.net.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe("test transaction", function () {
return new TransactionWatcher(
{
getTransaction: async (hash: string) => {
return await provider.getTransaction(hash, true);
return await provider.getTransaction(hash);
},
},
{ timeoutMilliseconds: 100000 },
Expand Down

0 comments on commit 4852ab7

Please sign in to comment.