Skip to content

sendMethodCall

sendMethodCall<ArgTypesOrMethod, MethodReturnType>(params): ArgTypesOrMethod extends Function ? ReturnType<ArgTypesOrMethod> : MethodReturnType

Sends ABI method call. The two type arguments in combination with the name argument are used to form the the method signature to ensure typesafety.

Type parameters

ArgTypesOrMethod

Either the TEALScript method to call or the types of the method arguments

MethodReturnType = void

The return type of the method. NOT needed if ArgTypesOrMethod is TEALScript method type

Parameters

params: Expand<MethodCallParams<ArgTypesOrMethod>>

The parameters of the method call

Returns

ArgTypesOrMethod extends Function ? ReturnType<ArgTypesOrMethod> : MethodReturnType

The return value of the method call

Example

// call createNFT(string,string)uint64
const createdAsset = sendMethodCall<typeof MyContract.prototype.createNFT>({
applicationID: factoryApp,
methodArgs: ['My NFT', 'MNFT'],
});

Example

// call createNFT(string,string)uint64
const createdAsset = sendMethodCall<[string, string], Asset>({
applicationID: factoryApp,
name: 'createNFT',
methodArgs: ['My NFT', 'MNFT'],
});

Source

types/global.d.ts:1005