@bitgo/statics
Advanced tools
Comparing version 2.2.0 to 2.3.0-rc.0
@@ -31,2 +31,5 @@ import { BaseCoin, CoinFeature, UnderlyingAsset } from './base'; | ||
} | ||
export interface StellarCoinConstructorOptions extends AccountConstructorOptions { | ||
domain: string; | ||
} | ||
export interface ContractAddress extends String { | ||
@@ -53,3 +56,4 @@ __contractaddress_phantom__: never; | ||
export declare class StellarCoin extends AccountCoinToken { | ||
constructor(options: AccountConstructorOptions); | ||
domain: string; | ||
constructor(options: StellarCoinConstructorOptions); | ||
} | ||
@@ -105,2 +109,4 @@ /** | ||
* @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin. | ||
* @param domain Domain of the token issuer (used to access token information from the issuer's stellar.toml file) | ||
* See https://www.stellar.org/developers/guides/concepts/stellar-toml.html | ||
* @param prefix? Optional token prefix. Defaults to empty string | ||
@@ -111,3 +117,3 @@ * @param suffix? Optional token suffix. Defaults to token name. | ||
*/ | ||
export declare function stellarToken(name: string, fullName: string, decimalPlaces: number, asset: UnderlyingAsset, features?: CoinFeature[], prefix?: string, suffix?: string, network?: AccountNetwork): Readonly<StellarCoin>; | ||
export declare function stellarToken(name: string, fullName: string, decimalPlaces: number, asset: UnderlyingAsset, domain?: string, features?: CoinFeature[], prefix?: string, suffix?: string, network?: AccountNetwork): Readonly<StellarCoin>; | ||
/** | ||
@@ -120,2 +126,4 @@ * Factory function for testnet Stellar token instances. | ||
* @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin. | ||
* @param domain Domain of the token issuer (used to access token information from the issuer's stellar.toml file) | ||
* See https://www.stellar.org/developers/guides/concepts/stellar-toml.html | ||
* @param prefix? Optional token prefix. Defaults to empty string | ||
@@ -126,2 +134,2 @@ * @param suffix? Optional token suffix. Defaults to token name. | ||
*/ | ||
export declare function tstellarToken(name: string, fullName: string, decimalPlaces: number, asset: UnderlyingAsset, features?: CoinFeature[], prefix?: string, suffix?: string, network?: AccountNetwork): Readonly<StellarCoin>; | ||
export declare function tstellarToken(name: string, fullName: string, decimalPlaces: number, asset: UnderlyingAsset, domain?: string, features?: CoinFeature[], prefix?: string, suffix?: string, network?: AccountNetwork): Readonly<StellarCoin>; |
@@ -77,3 +77,3 @@ "use strict"; | ||
if (!options.contractAddress.match(/^0x[a-f0-9]{40}$/)) { | ||
throw new errors_1.InvalidContractAddress(options.name, options.contractAddress); | ||
throw new errors_1.InvalidContractAddressError(options.name, options.contractAddress); | ||
} | ||
@@ -95,3 +95,9 @@ _this.contractAddress = options.contractAddress; | ||
function StellarCoin(options) { | ||
return _super.call(this, __assign({}, options)) || this; | ||
var _this = _super.call(this, __assign({}, options)) || this; | ||
var domainPattern = /^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$/; | ||
if (options.domain !== '' && !options.domain.match(domainPattern)) { | ||
throw new errors_1.InvalidDomainError(options.name, options.domain); | ||
} | ||
_this.domain = options.domain; | ||
return _this; | ||
} | ||
@@ -192,2 +198,4 @@ return StellarCoin; | ||
* @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin. | ||
* @param domain Domain of the token issuer (used to access token information from the issuer's stellar.toml file) | ||
* See https://www.stellar.org/developers/guides/concepts/stellar-toml.html | ||
* @param prefix? Optional token prefix. Defaults to empty string | ||
@@ -198,3 +206,4 @@ * @param suffix? Optional token suffix. Defaults to token name. | ||
*/ | ||
function stellarToken(name, fullName, decimalPlaces, asset, features, prefix, suffix, network) { | ||
function stellarToken(name, fullName, decimalPlaces, asset, domain, features, prefix, suffix, network) { | ||
if (domain === void 0) { domain = ''; } | ||
if (features === void 0) { features = AccountCoin.DEFAULT_FEATURES; } | ||
@@ -207,8 +216,9 @@ if (prefix === void 0) { prefix = ''; } | ||
fullName: fullName, | ||
network: network, | ||
decimalPlaces: decimalPlaces, | ||
asset: asset, | ||
domain: domain, | ||
features: features, | ||
prefix: prefix, | ||
suffix: suffix, | ||
features: features, | ||
decimalPlaces: decimalPlaces, | ||
asset: asset, | ||
network: network, | ||
isToken: true, | ||
@@ -225,2 +235,4 @@ })); | ||
* @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin. | ||
* @param domain Domain of the token issuer (used to access token information from the issuer's stellar.toml file) | ||
* See https://www.stellar.org/developers/guides/concepts/stellar-toml.html | ||
* @param prefix? Optional token prefix. Defaults to empty string | ||
@@ -231,3 +243,4 @@ * @param suffix? Optional token suffix. Defaults to token name. | ||
*/ | ||
function tstellarToken(name, fullName, decimalPlaces, asset, features, prefix, suffix, network) { | ||
function tstellarToken(name, fullName, decimalPlaces, asset, domain, features, prefix, suffix, network) { | ||
if (domain === void 0) { domain = ''; } | ||
if (features === void 0) { features = AccountCoin.DEFAULT_FEATURES; } | ||
@@ -237,5 +250,5 @@ if (prefix === void 0) { prefix = ''; } | ||
if (network === void 0) { network = networks_1.Networks.test.stellar; } | ||
return stellarToken(name, fullName, decimalPlaces, asset, features, prefix, suffix, network); | ||
return stellarToken(name, fullName, decimalPlaces, asset, domain, features, prefix, suffix, network); | ||
} | ||
exports.tstellarToken = tstellarToken; | ||
//# sourceMappingURL=account.js.map |
@@ -166,5 +166,7 @@ import { BaseNetwork } from './networks'; | ||
EUX = "eux", | ||
EXE = "exe", | ||
FET = "fet", | ||
FMF = "fmf", | ||
FSN = "fsn", | ||
FTT = "ftt", | ||
FUN = "fun", | ||
@@ -263,2 +265,3 @@ FXRT = "fxrt", | ||
PRO = "pro", | ||
PRTS = "prts", | ||
QASH = "qash", | ||
@@ -314,2 +317,3 @@ QRL = "qrl", | ||
UKG = "ukg", | ||
UP = "up", | ||
UPBTC = "upbtc", | ||
@@ -337,2 +341,3 @@ UPP = "upp", | ||
XRL = "xrl", | ||
YNG = "yng", | ||
YSEY = "ysey", | ||
@@ -345,3 +350,8 @@ ZARX = "zarx", | ||
ZRX = "zrx", | ||
'xlm:BST-GADDFE4R72YUP2AOEL67OHZN3GJQYPC3VE734N2XFMEGRR2L32CZ3XYZ' = "xlm:BST-GADDFE4R72YUP2AOEL67OHZN3GJQYPC3VE734N2XFMEGRR2L32CZ3XYZ", | ||
'xlm:VELO-GC7GMEKN2P5LKGOVW55WGHMVQRPPRPHIRFMIC75Z6WPYPYR7B3Z3WEKH' = "xlm:VELO-GC7GMEKN2P5LKGOVW55WGHMVQRPPRPHIRFMIC75Z6WPYPYR7B3Z3WEKH", | ||
'xlm:SLT-GCKA6K5PCQ6PNF5RQBF7PQDJWRHO6UOGFMRLK3DYHDOI244V47XKQ4GP' = "xlm:SLT-GCKA6K5PCQ6PNF5RQBF7PQDJWRHO6UOGFMRLK3DYHDOI244V47XKQ4GP", | ||
'xlm:USD-GDUKMGUGDZQK6YHYA5Z6AY2G4XDSZPSZ3SW5UN3ARVMO6QSRDWP5YLEX' = "xlm:USD-GDUKMGUGDZQK6YHYA5Z6AY2G4XDSZPSZ3SW5UN3ARVMO6QSRDWP5YLEX", | ||
'xlm:ETH-GBVOL67TMUQBGL4TZYNMY3ZQ5WGQYFPFD5VJRWXR72VA33VFNL225PL5' = "xlm:ETH-GBVOL67TMUQBGL4TZYNMY3ZQ5WGQYFPFD5VJRWXR72VA33VFNL225PL5", | ||
'xlm:WXT-GASBLVHS5FOABSDNW5SPPH3QRJYXY5JHA2AOA2QHH2FJLZBRXSG4SWXT' = "xlm:WXT-GASBLVHS5FOABSDNW5SPPH3QRJYXY5JHA2AOA2QHH2FJLZBRXSG4SWXT", | ||
TEST = "test", | ||
@@ -348,0 +358,0 @@ SCHZ = "schz", |
@@ -154,5 +154,7 @@ "use strict"; | ||
account_1.erc20('eux', 'EUR Stable Token', 18, '0x1b9064207e8046ec1d8e83de79380ed31283914f', "eux" /* EUX */), | ||
account_1.erc20('exe', 'EXE Token', 8, '0x0d9a653f681168f410d14d19b7743c041eafc58a', "exe" /* EXE */), | ||
account_1.erc20('fet', 'Fetch', 18, '0x1d287cc25dad7ccaf76a26bc660c5f7c8e2a05bd', "fet" /* FET */), | ||
account_1.erc20('fmf', 'Formosa Financial', 18, '0xb4d0fdfc8497aef97d3c2892ae682ee06064a2bc', "fmf" /* FMF */), | ||
account_1.erc20('fsn', 'Fusion', 18, '0xd0352a019e9ab9d757776f532377aaebd36fd541', "fsn" /* FSN */), | ||
account_1.erc20('ftt', 'FTX Token', 18, '0x50d1c9771902476076ecfc8b2a83ad6b9355a4c9', "ftt" /* FTT */), | ||
account_1.erc20('fun', 'FunFair', 8, '0x419d0d8bdd9af5e606ae2232ed285aff190e711b', "fun" /* FUN */), | ||
@@ -251,2 +253,3 @@ account_1.erc20('fxrt', 'FXRT', 3, '0x506742a24c54b77c5af4065b2626ab96c641f90e', "fxrt" /* FXRT */), | ||
account_1.erc20('pro', 'Propy', 18, '0x9041fe5b3fdea0f5e4afdc17e75180738d877a01', "pro" /* PRO */), | ||
account_1.erc20('prts', 'Protos', 0, '0x835a44027ee4e92bbd8874e5ede9e5148b069e96', "prts" /* PRTS */), | ||
account_1.erc20('qash', 'QASH', 6, '0x618e75ac90b12c6049ba3b27f5d5f8651b0037f6', "qash" /* QASH */), | ||
@@ -302,2 +305,3 @@ account_1.erc20('qrl', 'Qrl', 8, '0x697beac28b09e122c4332d163985e8a73121b97f', "qrl" /* QRL */), | ||
account_1.erc20('ukg', 'UnikoinGold', 18, '0x24692791bc444c5cd0b81e3cbcaba4b04acd1f3b', "ukg" /* UKG */), | ||
account_1.erc20('up', 'UpToken', 8, '0x6ba460ab75cd2c56343b3517ffeba60748654d26', "up" /* UP */), | ||
account_1.erc20('upbtc', 'Universal Bitcoin', 8, '0xc7461b398005e50bcc43c8e636378c6722e76c01', "upbtc" /* UPBTC */), | ||
@@ -325,2 +329,3 @@ account_1.erc20('upp', 'Sentinel Protocol', 18, '0xc86d054809623432210c107af2e3f619dcfbf652', "upp" /* UPP */), | ||
account_1.erc20('xrl', 'Rialto', 9, '0xb24754be79281553dc1adc160ddf5cd9b74361a4', "xrl" /* XRL */), | ||
account_1.erc20('yng', 'Young Token', 18, '0xa26cbb76156090f4b40a1799a220fc4c946afb3c', "yng" /* YNG */), | ||
account_1.erc20('ysey', 'YSEY Utility Token', 3, '0x1358efe5d9bfc2005918c0b2f220a4345c9ee7a3', "ysey" /* YSEY */), | ||
@@ -333,3 +338,8 @@ account_1.erc20('zarx', 'eToro South African Rand', 18, '0x29ec3ff4e1dcad5a207dbd5d14e48073abba0bd3', "zarx" /* ZARX */), | ||
account_1.erc20('zrx', '0x Token', 18, '0xe41d2489571d322189246dafa5ebde1f4699f498', "zrx" /* ZRX */), | ||
account_1.stellarToken('xlm:VELO-GC7GMEKN2P5LKGOVW55WGHMVQRPPRPHIRFMIC75Z6WPYPYR7B3Z3WEKH', 'Velo Token', 7, "xlm:VELO-GC7GMEKN2P5LKGOVW55WGHMVQRPPRPHIRFMIC75Z6WPYPYR7B3Z3WEKH" /* 'xlm:VELO-GC7GMEKN2P5LKGOVW55WGHMVQRPPRPHIRFMIC75Z6WPYPYR7B3Z3WEKH' */), | ||
account_1.stellarToken('xlm:BST-GADDFE4R72YUP2AOEL67OHZN3GJQYPC3VE734N2XFMEGRR2L32CZ3XYZ', 'BitGo Shield Token', 7, "xlm:BST-GADDFE4R72YUP2AOEL67OHZN3GJQYPC3VE734N2XFMEGRR2L32CZ3XYZ" /* 'xlm:BST-GADDFE4R72YUP2AOEL67OHZN3GJQYPC3VE734N2XFMEGRR2L32CZ3XYZ' */, 'bitgo.com'), | ||
account_1.stellarToken('xlm:VELO-GC7GMEKN2P5LKGOVW55WGHMVQRPPRPHIRFMIC75Z6WPYPYR7B3Z3WEKH', 'Velo Token', 7, "xlm:VELO-GC7GMEKN2P5LKGOVW55WGHMVQRPPRPHIRFMIC75Z6WPYPYR7B3Z3WEKH" /* 'xlm:VELO-GC7GMEKN2P5LKGOVW55WGHMVQRPPRPHIRFMIC75Z6WPYPYR7B3Z3WEKH' */, 'velo.org'), | ||
account_1.stellarToken('xlm:SLT-GCKA6K5PCQ6PNF5RQBF7PQDJWRHO6UOGFMRLK3DYHDOI244V47XKQ4GP', 'Smartlands Token', 7, "xlm:SLT-GCKA6K5PCQ6PNF5RQBF7PQDJWRHO6UOGFMRLK3DYHDOI244V47XKQ4GP" /* 'xlm:SLT-GCKA6K5PCQ6PNF5RQBF7PQDJWRHO6UOGFMRLK3DYHDOI244V47XKQ4GP' */, 'smartlands.io'), | ||
account_1.stellarToken('xlm:USD-GDUKMGUGDZQK6YHYA5Z6AY2G4XDSZPSZ3SW5UN3ARVMO6QSRDWP5YLEX', 'US Dollar', 7, "xlm:USD-GDUKMGUGDZQK6YHYA5Z6AY2G4XDSZPSZ3SW5UN3ARVMO6QSRDWP5YLEX" /* 'xlm:USD-GDUKMGUGDZQK6YHYA5Z6AY2G4XDSZPSZ3SW5UN3ARVMO6QSRDWP5YLEX' */, 'anchorusd.com'), | ||
account_1.stellarToken('xlm:ETH-GBVOL67TMUQBGL4TZYNMY3ZQ5WGQYFPFD5VJRWXR72VA33VFNL225PL5', 'Ethereum', 7, "xlm:ETH-GBVOL67TMUQBGL4TZYNMY3ZQ5WGQYFPFD5VJRWXR72VA33VFNL225PL5" /* 'xlm:ETH-GBVOL67TMUQBGL4TZYNMY3ZQ5WGQYFPFD5VJRWXR72VA33VFNL225PL5' */, 'stellarport.io'), | ||
account_1.stellarToken('xlm:WXT-GASBLVHS5FOABSDNW5SPPH3QRJYXY5JHA2AOA2QHH2FJLZBRXSG4SWXT', 'Wirex Token', 7, "xlm:WXT-GASBLVHS5FOABSDNW5SPPH3QRJYXY5JHA2AOA2QHH2FJLZBRXSG4SWXT" /* 'xlm:WXT-GASBLVHS5FOABSDNW5SPPH3QRJYXY5JHA2AOA2QHH2FJLZBRXSG4SWXT' */, 'wxt.wirexapp.com'), | ||
account_1.terc20('terc', 'ERC Test Token', 0, '0x945ac907cf021a6bcd07852bb3b8c087051706a9', "erc" /* ERC */), | ||
@@ -341,3 +351,3 @@ account_1.terc20('test', 'Test Mintable ERC20 Token', 18, '0x1fb879581f31687b905653d4bbcbe3af507bed37', "test" /* TEST */), | ||
account_1.terc20('tfmf', 'Test Formosa Financial Token', 18, '0xd8463d2f8c5b3be9de95c63b73a0ae4c79423452', "fmf" /* FMF */), | ||
account_1.tstellarToken('txlm:BST-GBQTIOS3XGHB7LVYGBKQVJGCZ3R4JL5E4CBSWJ5ALIJUHBKS6263644L', 'Test BST Token', 7, "txlm:BST-GBQTIOS3XGHB7LVYGBKQVJGCZ3R4JL5E4CBSWJ5ALIJUHBKS6263644L" /* 'txlm:BST-GBQTIOS3XGHB7LVYGBKQVJGCZ3R4JL5E4CBSWJ5ALIJUHBKS6263644L' */), | ||
account_1.tstellarToken('txlm:BST-GBQTIOS3XGHB7LVYGBKQVJGCZ3R4JL5E4CBSWJ5ALIJUHBKS6263644L', 'BitGo Shield Token', 7, "txlm:BST-GBQTIOS3XGHB7LVYGBKQVJGCZ3R4JL5E4CBSWJ5ALIJUHBKS6263644L" /* 'txlm:BST-GBQTIOS3XGHB7LVYGBKQVJGCZ3R4JL5E4CBSWJ5ALIJUHBKS6263644L' */, 'bitgo.com'), | ||
ofc_1.tofcerc20('ofcterc', 'ERC Test Token', 0, "erc" /* ERC */), | ||
@@ -344,0 +354,0 @@ ofc_1.ofcerc20('ofcerc', 'ERC Token', 0, "erc" /* ERC */), |
@@ -21,5 +21,8 @@ /** | ||
} | ||
export declare class InvalidContractAddress extends BitGoStaticsError { | ||
export declare class InvalidContractAddressError extends BitGoStaticsError { | ||
constructor(coinName: string, contractAddress: string); | ||
} | ||
export declare class InvalidDomainError extends BitGoStaticsError { | ||
constructor(coinName: string, domain: string); | ||
} | ||
export declare class ConflictingCoinFeaturesError extends BitGoStaticsError { | ||
@@ -26,0 +29,0 @@ constructor(coinName: string, conflictingFeatures: CoinFeature[]); |
@@ -66,12 +66,22 @@ "use strict"; | ||
exports.MissingRequiredCoinFeatureError = MissingRequiredCoinFeatureError; | ||
var InvalidContractAddress = /** @class */ (function (_super) { | ||
__extends(InvalidContractAddress, _super); | ||
function InvalidContractAddress(coinName, contractAddress) { | ||
var InvalidContractAddressError = /** @class */ (function (_super) { | ||
__extends(InvalidContractAddressError, _super); | ||
function InvalidContractAddressError(coinName, contractAddress) { | ||
var _this = _super.call(this, "invalid contract address '" + contractAddress + "' for coin '" + coinName + "'") || this; | ||
Object.setPrototypeOf(_this, InvalidContractAddress.prototype); | ||
Object.setPrototypeOf(_this, InvalidContractAddressError.prototype); | ||
return _this; | ||
} | ||
return InvalidContractAddress; | ||
return InvalidContractAddressError; | ||
}(BitGoStaticsError)); | ||
exports.InvalidContractAddress = InvalidContractAddress; | ||
exports.InvalidContractAddressError = InvalidContractAddressError; | ||
var InvalidDomainError = /** @class */ (function (_super) { | ||
__extends(InvalidDomainError, _super); | ||
function InvalidDomainError(coinName, domain) { | ||
var _this = _super.call(this, "invalid domain '" + domain + "' for coin '" + coinName + "'") || this; | ||
Object.setPrototypeOf(_this, InvalidDomainError.prototype); | ||
return _this; | ||
} | ||
return InvalidDomainError; | ||
}(BitGoStaticsError)); | ||
exports.InvalidDomainError = InvalidDomainError; | ||
var ConflictingCoinFeaturesError = /** @class */ (function (_super) { | ||
@@ -81,3 +91,3 @@ __extends(ConflictingCoinFeaturesError, _super); | ||
var _this = _super.call(this, "coin feature(s) for coin '" + coinName + "' cannot be both required and disallowed: " + conflictingFeatures.join(', ')) || this; | ||
Object.setPrototypeOf(_this, InvalidContractAddress.prototype); | ||
Object.setPrototypeOf(_this, ConflictingCoinFeaturesError.prototype); | ||
return _this; | ||
@@ -84,0 +94,0 @@ } |
{ | ||
"name": "@bitgo/statics", | ||
"version": "2.2.0", | ||
"version": "2.3.0-rc.0", | ||
"description": "dependency-free static configuration for the bitgo platform", | ||
@@ -5,0 +5,0 @@ "main": "./dist/src/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
170068
2509
3