createToken method
Future<String>
createToken(
- AptosAccount account,
- String collectionName,
- String name,
- String description,
- int supply,
- String uri, {
- BigInt? max,
- String? royaltyPayeeAddress,
- int? royaltyPointsDenominator,
- int? royaltyPointsNumerator,
- List<
String> ? propertyKeys, - List<
String> ? propertyValues, - List<
String> ? propertyTypes, - BigInt? maxGasAmount,
- BigInt? gasUnitPrice,
- BigInt? expireTimestamp,
Creates a new NFT within the specified account and return the hash of the transaction submitted to the API.
Implementation
Future<String> createToken(
AptosAccount account,
String collectionName,
String name,
String description,
int supply,
String uri,
{BigInt? max,
String? royaltyPayeeAddress,
int? royaltyPointsDenominator,
int? royaltyPointsNumerator,
List<String>? propertyKeys,
List<String>? propertyValues,
List<String>? propertyTypes,
BigInt? maxGasAmount,
BigInt? gasUnitPrice,
BigInt? expireTimestamp}
) async {
max ??= MAX_U64_BIG_INT;
royaltyPayeeAddress ??= account.address;
royaltyPointsDenominator ??= 0;
royaltyPointsNumerator ??= 0;
propertyKeys ??= [];
propertyValues ??= [];
propertyTypes ??= [];
final payload = transactionBuilder.buildTransactionPayload(
"0x3::token::create_token_script",
[],
[
collectionName,
name,
description,
supply,
max,
uri,
royaltyPayeeAddress,
royaltyPointsDenominator,
royaltyPointsNumerator,
[false, false, false, false, false],
propertyKeys,
getPropertyValueRaw(propertyValues, propertyTypes),
propertyTypes,
],
);
return aptosClient.generateSignSubmitTransaction(
account,
payload,
maxGasAmount: maxGasAmount,
gasUnitPrice: gasUnitPrice,
expireTimestamp: expireTimestamp
);
}