Skip to content

Commit 1f4cfaf

Browse files
authored
Merge pull request #6295 from BitGo/COIN-4495
feat(sdk-coin-near): added storage deposit amount to token config
2 parents b4f30be + 5b85304 commit 1f4cfaf

File tree

4 files changed

+30
-1
lines changed

4 files changed

+30
-1
lines changed

modules/sdk-coin-near/src/nep141Token.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ export class Nep141Token extends Near {
4343
return this.tokenConfig.decimalPlaces;
4444
}
4545

46+
get storageDepositAmount(): string {
47+
return this.tokenConfig.storageDepositAmount;
48+
}
49+
4650
getChain(): string {
4751
return this.tokenConfig.type;
4852
}

modules/statics/src/account.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ export interface Sip10TokenConstructorOptions extends AccountConstructorOptions
143143

144144
export interface Nep141TokenConstructorOptions extends AccountConstructorOptions {
145145
contractAddress: string;
146+
storageDepositAmount: string;
146147
}
147148

148149
export interface ContractAddress extends String {
@@ -591,12 +592,14 @@ export class Sip10Token extends AccountCoinToken {
591592
*/
592593
export class Nep141Token extends AccountCoinToken {
593594
public contractAddress: string;
595+
public storageDepositAmount: string;
594596
constructor(options: Nep141TokenConstructorOptions) {
595597
super({
596598
...options,
597599
});
598600

599601
this.contractAddress = options.contractAddress;
602+
this.storageDepositAmount = options.storageDepositAmount;
600603
}
601604
}
602605

@@ -2928,6 +2931,7 @@ export function tsip10Token(
29282931
* @param fullName Complete human-readable name of the token
29292932
* @param decimalPlaces Number of decimal places this token supports (divisibility exponent)
29302933
* @param contractAddress Contract address of this token
2934+
* @param storageDepositAmount the deposit amount needed to get registered with this contract
29312935
* @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin.
29322936
* @param features Features of this coin. Defaults to the DEFAULT_FEATURES defined in `AccountCoin`
29332937
* @param prefix Optional token prefix. Defaults to empty string
@@ -2941,6 +2945,7 @@ export function nep141Token(
29412945
fullName: string,
29422946
decimalPlaces: number,
29432947
contractAddress: string,
2948+
storageDepositAmount: string,
29442949
asset: UnderlyingAsset,
29452950
features: CoinFeature[] = AccountCoin.DEFAULT_FEATURES,
29462951
prefix = '',
@@ -2956,6 +2961,7 @@ export function nep141Token(
29562961
network,
29572962
decimalPlaces,
29582963
contractAddress,
2964+
storageDepositAmount,
29592965
prefix,
29602966
suffix,
29612967
features,
@@ -2975,6 +2981,7 @@ export function nep141Token(
29752981
* @param fullName Complete human-readable name of the token
29762982
* @param decimalPlaces Number of decimal places this token supports (divisibility exponent)
29772983
* @param contractAddress Contract address of this token
2984+
* @param storageDepositAmount the deposit amount needed to get registered with this contract
29782985
* @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin.
29792986
* @param features Features of this coin. Defaults to the DEFAULT_FEATURES defined in `AccountCoin`
29802987
* @param prefix Optional token prefix. Defaults to empty string
@@ -2987,11 +2994,24 @@ export function tnep141Token(
29872994
fullName: string,
29882995
decimalPlaces: number,
29892996
contractAddress: string,
2997+
storageDepositAmount: string,
29902998
asset: UnderlyingAsset,
29912999
features: CoinFeature[] = AccountCoin.DEFAULT_FEATURES,
29923000
prefix = '',
29933001
suffix: string = name.toUpperCase(),
29943002
network: AccountNetwork = Networks.test.near
29953003
) {
2996-
return nep141Token(id, name, fullName, decimalPlaces, contractAddress, asset, features, prefix, suffix, network);
3004+
return nep141Token(
3005+
id,
3006+
name,
3007+
fullName,
3008+
decimalPlaces,
3009+
contractAddress,
3010+
storageDepositAmount,
3011+
asset,
3012+
features,
3013+
prefix,
3014+
suffix,
3015+
network
3016+
);
29973017
}

modules/statics/src/coins/nep141Tokens.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export const nep141Tokens = [
99
'USD Coin',
1010
6,
1111
'17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1',
12+
'1250000000000000000000',
1213
UnderlyingAsset['near:usdc'],
1314
NEAR_TOKEN_FEATURES
1415
),
@@ -18,6 +19,7 @@ export const nep141Tokens = [
1819
'Tether USD',
1920
6,
2021
'usdt.tether-token.near',
22+
'1250000000000000000000',
2123
UnderlyingAsset['near:usdt'],
2224
NEAR_TOKEN_FEATURES
2325
),
@@ -28,6 +30,7 @@ export const nep141Tokens = [
2830
'Test NEP141 Token 24 Decimals',
2931
24,
3032
'ft-tnep24dp.testnet',
33+
'1250000000000000000000',
3134
UnderlyingAsset['tnear:tnep24dp'],
3235
NEAR_TOKEN_FEATURES
3336
),

modules/statics/src/tokenConfig.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ export type Sip10TokenConfig = BaseNetworkConfig & {
109109

110110
export type Nep141TokenConfig = BaseNetworkConfig & {
111111
contractAddress: string;
112+
storageDepositAmount: string;
112113
};
113114

114115
export type TokenConfig =
@@ -809,6 +810,7 @@ function getNep141TokenConfig(coin: Nep141Token): Nep141TokenConfig {
809810
network: coin.network.type === NetworkType.MAINNET ? 'Mainnet' : 'Testnet',
810811
name: coin.fullName,
811812
contractAddress: coin.contractAddress,
813+
storageDepositAmount: coin.storageDepositAmount,
812814
decimalPlaces: coin.decimalPlaces,
813815
};
814816
}

0 commit comments

Comments
 (0)