Skip to content

Commit 7dbbdcd

Browse files
committed
feat: added contractAddress for canton tokens
Ticket: COIN-7295
1 parent e711153 commit 7dbbdcd

File tree

3 files changed

+13
-26
lines changed

3 files changed

+13
-26
lines changed

modules/statics/src/account.ts

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,7 @@ export interface AdaTokenConstructorOptions extends AccountConstructorOptions {
185185

186186
export interface CantonTokenConstructorOptions extends AccountConstructorOptions {
187187
baseUrl: string;
188-
admin: string;
189-
assetName: string;
188+
contractAddress: string;
190189
}
191190

192191
export interface ContractAddress extends String {
@@ -789,15 +788,13 @@ export class AdaToken extends AccountCoinToken {
789788
*/
790789
export class CantonToken extends AccountCoinToken {
791790
public baseUrl: string;
792-
public admin: string;
793-
public assetName: string;
791+
public contractAddress: string;
794792
constructor(options: CantonTokenConstructorOptions) {
795793
super({
796794
...options,
797795
});
798796
this.baseUrl = options.baseUrl;
799-
this.admin = options.admin;
800-
this.assetName = options.assetName;
797+
this.contractAddress = options.contractAddress;
801798
}
802799
}
803800

@@ -4207,8 +4204,7 @@ export function tjettonToken(
42074204
* @param fullName Complete human-readable name of the token
42084205
* @param decimalPlaces Number of decimal places this token supports (divisibility exponent)
42094206
* @param baseUrl token standard base url, ref: https://docs.digitalasset.com/utilities/devnet/overview/registry-user-guide/token-standard.html#token-standard-endpoints
4210-
* @param assetName the token instrument name
4211-
* @param admin the instrument admin for this token
4207+
* @param contractAddress the contract address of the token in the form `instrumentAdmin:instrumentId`
42124208
* @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin.
42134209
* @param features Features of this coin. Defaults to CANTON_FEATURES
42144210
* @param prefix Optional token prefix. Defaults to empty string
@@ -4222,8 +4218,7 @@ export function cantonToken(
42224218
fullName: string,
42234219
decimalPlaces: number,
42244220
baseUrl: string,
4225-
assetName: string,
4226-
admin: string,
4221+
contractAddress: string,
42274222
asset: UnderlyingAsset,
42284223
features: CoinFeature[] = CANTON_TOKEN_FEATURES,
42294224
prefix = '',
@@ -4239,8 +4234,7 @@ export function cantonToken(
42394234
decimalPlaces,
42404235
network,
42414236
baseUrl,
4242-
assetName,
4243-
admin,
4237+
contractAddress,
42444238
asset,
42454239
features,
42464240
prefix,
@@ -4260,8 +4254,7 @@ export function cantonToken(
42604254
* @param fullName Complete human-readable name of the token
42614255
* @param decimalPlaces Number of decimal places this token supports (divisibility exponent)
42624256
* @param baseUrl token standard base url
4263-
* @param assetName the token instrument name
4264-
* @param admin the instrument admin for this token
4257+
* @param contractAddress the contract address of the token in the form `instrumentAdmin:instrumentId`
42654258
* @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin.
42664259
* @param features Features of this coin. Defaults to the CANTON_FEATURES
42674260
* @param prefix Optional token prefix. Defaults to empty string
@@ -4275,8 +4268,7 @@ export function tcantonToken(
42754268
fullName: string,
42764269
decimalPlaces: number,
42774270
baseUrl: string,
4278-
assetName: string,
4279-
admin: string,
4271+
contractAddress: string,
42804272
asset: UnderlyingAsset,
42814273
features: CoinFeature[] = CANTON_TOKEN_FEATURES,
42824274
prefix = '',
@@ -4290,8 +4282,7 @@ export function tcantonToken(
42904282
fullName,
42914283
decimalPlaces,
42924284
baseUrl,
4293-
assetName,
4294-
admin,
4285+
contractAddress,
42954286
asset,
42964287
features,
42974288
prefix,

modules/statics/src/coins/cantonTokens.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ export const cantonTokens = [
1010
'Test Coin 1',
1111
10,
1212
'https://api.utilities.digitalasset-dev.com/api/token-standard/v0/registrars/',
13-
'TestCoin1',
14-
'auth0_007c65f857f1c3d599cb6df73775::1220d2d732d042c281cee80f483ab80f3cbaa4782860ed5f4dc228ab03dedd2ee8f9',
13+
'auth0_007c65f857f1c3d599cb6df73775::1220d2d732d042c281cee80f483ab80f3cbaa4782860ed5f4dc228ab03dedd2ee8f9:TestCoin1',
1514
UnderlyingAsset['tcanton:testcoin1'],
1615
CANTON_TOKEN_FEATURES
1716
),
@@ -21,8 +20,7 @@ export const cantonTokens = [
2120
'Test Token',
2221
10,
2322
'https://api.utilities.digitalasset-dev.com/api/token-standard/v0/registrars/',
24-
'TestToken',
25-
'auth0_007c65f857f1c3d599cb6df73775::1220d2d732d042c281cee80f483ab80f3cbaa4782860ed5f4dc228ab03dedd2ee8f9',
23+
'auth0_007c65f857f1c3d599cb6df73775::1220d2d732d042c281cee80f483ab80f3cbaa4782860ed5f4dc228ab03dedd2ee8f9:TestToken',
2624
UnderlyingAsset['tcanton:testtoken'],
2725
CANTON_TOKEN_FEATURES
2826
),

modules/statics/src/tokenConfig.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,7 @@ export type Nep141TokenConfig = BaseNetworkConfig & {
138138

139139
export type CantonTokenConfig = BaseNetworkConfig & {
140140
baseUrl: string;
141-
assetName: string;
142-
admin: string;
141+
contractAddress: string;
143142
};
144143

145144
export type VetTokenConfig = BaseNetworkConfig & {
@@ -1041,8 +1040,7 @@ function getCantonTokenConfig(coin: CantonToken): CantonTokenConfig {
10411040
name: coin.fullName,
10421041
decimalPlaces: coin.decimalPlaces,
10431042
baseUrl: coin.baseUrl,
1044-
admin: coin.admin,
1045-
assetName: coin.assetName,
1043+
contractAddress: coin.contractAddress,
10461044
};
10471045
}
10481046
const getFormattedCantonTokens = (customCoinMap = coins) =>

0 commit comments

Comments
 (0)