-
Notifications
You must be signed in to change notification settings - Fork 274
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(sdk-coin-zketh): add zketh token support
Ticket: WIN-1422
- Loading branch information
Showing
14 changed files
with
233 additions
and
14 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export * from './lib'; | ||
export * from './zketh'; | ||
export * from './tzketh'; | ||
export * from './zkethToken'; | ||
export * from './register'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* @prettier | ||
*/ | ||
import { EthLikeTokenConfig } from '@bitgo/statics'; | ||
import { BitGoBase, CoinConstructor, NamedCoinConstructor } from '@bitgo/sdk-core'; | ||
import { CoinNames, EthLikeToken } from '@bitgo/abstract-eth'; | ||
|
||
export { EthLikeTokenConfig }; | ||
|
||
export class ZkethToken extends EthLikeToken { | ||
public readonly tokenConfig: EthLikeTokenConfig; | ||
static coinNames: CoinNames = { | ||
Mainnet: 'zketh', | ||
Testnet: 'tzketh', | ||
}; | ||
constructor(bitgo: BitGoBase, tokenConfig: EthLikeTokenConfig) { | ||
super(bitgo, tokenConfig, ZkethToken.coinNames); | ||
} | ||
static createTokenConstructor(config: EthLikeTokenConfig): CoinConstructor { | ||
return super.createTokenConstructor(config, ZkethToken.coinNames); | ||
} | ||
|
||
static createTokenConstructors(): NamedCoinConstructor[] { | ||
return super.createTokenConstructors(ZkethToken.coinNames); | ||
} | ||
|
||
getFullName(): string { | ||
return 'Zketh Token'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import 'should'; | ||
|
||
import { TestBitGo, TestBitGoAPI } from '@bitgo/sdk-test'; | ||
import { ZkethToken } from '../../src'; | ||
import { BitGoAPI } from '@bitgo/sdk-api'; | ||
|
||
describe('Zketh Token:', function () { | ||
let bitgo: TestBitGoAPI; | ||
let zkethTokenCoin; | ||
const tokenName = 'tzketh:usdt'; | ||
|
||
before(function () { | ||
bitgo = TestBitGo.decorate(BitGoAPI, { env: 'test' }); | ||
ZkethToken.createTokenConstructors().forEach(({ name, coinConstructor }) => { | ||
bitgo.safeRegister(name, coinConstructor); | ||
}); | ||
bitgo.initializeTestVars(); | ||
zkethTokenCoin = bitgo.coin(tokenName); | ||
}); | ||
|
||
it('should return constants', function () { | ||
zkethTokenCoin.getChain().should.equal('tzketh:usdt'); | ||
zkethTokenCoin.getBaseChain().should.equal('tzketh'); | ||
zkethTokenCoin.getFullName().should.equal('Zketh Token'); | ||
zkethTokenCoin.getBaseFactor().should.equal(1e18); | ||
zkethTokenCoin.type.should.equal(tokenName); | ||
zkethTokenCoin.name.should.equal('zkSync Test USDT'); | ||
zkethTokenCoin.coin.should.equal('tzketh'); | ||
zkethTokenCoin.network.should.equal('Testnet'); | ||
zkethTokenCoin.decimalPlaces.should.equal(18); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.