Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions modules/sdk-coin-canton/src/cantonToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,8 @@ export class CantonToken extends Canton {
return this.tokenConfig.baseUrl;
}

get admin(): string {
return this.tokenConfig.admin;
}

get assetName(): string {
return this.tokenConfig.assetName;
get contractAddress(): string {
return this.tokenConfig.contractAddress;
}

get decimalPlaces(): number {
Expand Down
27 changes: 9 additions & 18 deletions modules/statics/src/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,7 @@ export interface AdaTokenConstructorOptions extends AccountConstructorOptions {

export interface CantonTokenConstructorOptions extends AccountConstructorOptions {
baseUrl: string;
admin: string;
assetName: string;
contractAddress: string;
}

export interface ContractAddress extends String {
Expand Down Expand Up @@ -789,15 +788,13 @@ export class AdaToken extends AccountCoinToken {
*/
export class CantonToken extends AccountCoinToken {
public baseUrl: string;
public admin: string;
public assetName: string;
public contractAddress: string;
constructor(options: CantonTokenConstructorOptions) {
super({
...options,
});
this.baseUrl = options.baseUrl;
this.admin = options.admin;
this.assetName = options.assetName;
this.contractAddress = options.contractAddress;
}
}

Expand Down Expand Up @@ -4207,8 +4204,7 @@ export function tjettonToken(
* @param fullName Complete human-readable name of the token
* @param decimalPlaces Number of decimal places this token supports (divisibility exponent)
* @param baseUrl token standard base url, ref: https://docs.digitalasset.com/utilities/devnet/overview/registry-user-guide/token-standard.html#token-standard-endpoints
* @param assetName the token instrument name
* @param admin the instrument admin for this token
* @param contractAddress the contract address of the token in the form `instrumentAdmin:instrumentId`
* @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin.
* @param features Features of this coin. Defaults to CANTON_FEATURES
* @param prefix Optional token prefix. Defaults to empty string
Expand All @@ -4222,8 +4218,7 @@ export function cantonToken(
fullName: string,
decimalPlaces: number,
baseUrl: string,
assetName: string,
admin: string,
contractAddress: string,
asset: UnderlyingAsset,
features: CoinFeature[] = CANTON_TOKEN_FEATURES,
prefix = '',
Expand All @@ -4239,8 +4234,7 @@ export function cantonToken(
decimalPlaces,
network,
baseUrl,
assetName,
admin,
contractAddress,
asset,
features,
prefix,
Expand All @@ -4260,8 +4254,7 @@ export function cantonToken(
* @param fullName Complete human-readable name of the token
* @param decimalPlaces Number of decimal places this token supports (divisibility exponent)
* @param baseUrl token standard base url
* @param assetName the token instrument name
* @param admin the instrument admin for this token
* @param contractAddress the contract address of the token in the form `instrumentAdmin:instrumentId`
* @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin.
* @param features Features of this coin. Defaults to the CANTON_FEATURES
* @param prefix Optional token prefix. Defaults to empty string
Expand All @@ -4275,8 +4268,7 @@ export function tcantonToken(
fullName: string,
decimalPlaces: number,
baseUrl: string,
assetName: string,
admin: string,
contractAddress: string,
asset: UnderlyingAsset,
features: CoinFeature[] = CANTON_TOKEN_FEATURES,
prefix = '',
Expand All @@ -4290,8 +4282,7 @@ export function tcantonToken(
fullName,
decimalPlaces,
baseUrl,
assetName,
admin,
contractAddress,
asset,
features,
prefix,
Expand Down
4 changes: 4 additions & 0 deletions modules/statics/src/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3543,6 +3543,10 @@ export enum UnderlyingAsset {
'tcanton:testcoin1' = 'tcanton:testcoin1',
'tcanton:testtoken' = 'tcanton:testtoken',

// Canton mainnet tokens
'canton:usdcx' = 'canton:usdcx',
'canton:cbtc' = 'canton:cbtc',

// fiats
AED = 'aed',
EUR = 'eur',
Expand Down
28 changes: 23 additions & 5 deletions modules/statics/src/coins/cantonTokens.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,36 @@
import { tcantonToken } from '../account';
import { cantonToken, tcantonToken } from '../account';
import { UnderlyingAsset } from '../base';
import { CANTON_TOKEN_FEATURES } from '../coinFeatures';

export const cantonTokens = [
cantonToken(
'0ef822c5-2972-4087-a188-9dd48d132fc9',
'canton:usdcx',
'USDCx (Canton)',
10,
'https://api.utilities.digitalasset.com/api/token-standard/v0/registrars/',
'decentralized-usdc-interchain-rep::12208115f1e168dd7e792320be9c4ca720c751a02a3053c7606e1c1cd3dad9bf60ef:USDCx',
UnderlyingAsset['canton:usdcx'],
CANTON_TOKEN_FEATURES
),
cantonToken(
'76e62c81-5cd2-4e76-9750-cfab7d58f7b2',
'canton:cbtc',
'CBTC (Canton)',
10,
'https://api.utilities.digitalasset.com/api/token-standard/v0/registrars/',
'cbtc-network::12205af3b949a04776fc48cdcc05a060f6bda2e470632935f375d1049a8546a3b262:CBTC',
UnderlyingAsset['canton:cbtc'],
CANTON_TOKEN_FEATURES
),
// testnet tokens
tcantonToken(
'46356790-0ac4-4c3b-8b70-39094106d772',
'tcanton:testcoin1',
'Test Coin 1',
10,
'https://api.utilities.digitalasset-dev.com/api/token-standard/v0/registrars/',
'TestCoin1',
'auth0_007c65f857f1c3d599cb6df73775::1220d2d732d042c281cee80f483ab80f3cbaa4782860ed5f4dc228ab03dedd2ee8f9',
'auth0_007c65f857f1c3d599cb6df73775::1220d2d732d042c281cee80f483ab80f3cbaa4782860ed5f4dc228ab03dedd2ee8f9:TestCoin1',
UnderlyingAsset['tcanton:testcoin1'],
CANTON_TOKEN_FEATURES
),
Expand All @@ -21,8 +40,7 @@ export const cantonTokens = [
'Test Token',
10,
'https://api.utilities.digitalasset-dev.com/api/token-standard/v0/registrars/',
'TestToken',
'auth0_007c65f857f1c3d599cb6df73775::1220d2d732d042c281cee80f483ab80f3cbaa4782860ed5f4dc228ab03dedd2ee8f9',
'auth0_007c65f857f1c3d599cb6df73775::1220d2d732d042c281cee80f483ab80f3cbaa4782860ed5f4dc228ab03dedd2ee8f9:TestToken',
UnderlyingAsset['tcanton:testtoken'],
CANTON_TOKEN_FEATURES
),
Expand Down
6 changes: 2 additions & 4 deletions modules/statics/src/tokenConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,7 @@ export type Nep141TokenConfig = BaseNetworkConfig & {

export type CantonTokenConfig = BaseNetworkConfig & {
baseUrl: string;
assetName: string;
admin: string;
contractAddress: string;
};

export type VetTokenConfig = BaseNetworkConfig & {
Expand Down Expand Up @@ -1041,8 +1040,7 @@ function getCantonTokenConfig(coin: CantonToken): CantonTokenConfig {
name: coin.fullName,
decimalPlaces: coin.decimalPlaces,
baseUrl: coin.baseUrl,
admin: coin.admin,
assetName: coin.assetName,
contractAddress: coin.contractAddress,
};
}
const getFormattedCantonTokens = (customCoinMap = coins) =>
Expand Down
Loading