Comparing version 0.1.1 to 0.1.2
{ | ||
"name": "dexterlib", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Tezos Dexter Utility Library", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
100
src/token.ts
@@ -5,2 +5,7 @@ import { TezosToolkit } from '@taquito/taquito'; | ||
export enum Network { | ||
Mainnet = 'mainnet', | ||
Delphinet = 'delphinet', | ||
} | ||
export class Token { | ||
@@ -12,2 +17,3 @@ protected tezos: TezosToolkit; | ||
protected secretKey: string; | ||
protected network: Network; | ||
@@ -18,3 +24,4 @@ constructor( | ||
toolkit: TezosToolkit, | ||
secretKey: string | ||
secretKey: string, | ||
network: Network | ||
) { | ||
@@ -25,2 +32,3 @@ this.poolContractAddress = poolAddress; | ||
this.secretKey = secretKey; | ||
this.network = network; | ||
} | ||
@@ -155,9 +163,17 @@ | ||
export class KUSD extends Token { | ||
constructor(toolkit: TezosToolkit, secretKey: string) { | ||
super( | ||
'KT1K9gCRgaLRFKTErYt1wVxA3Frb9FjasjTV', | ||
'KT1AbYeDbjjcAnV1QK7EZUUdqku77CdkTuv6', | ||
toolkit, | ||
secretKey | ||
); | ||
constructor(toolkit: TezosToolkit, secretKey: string, network: Network) { | ||
let assetContract = ''; | ||
let poolContract = ''; | ||
switch (network) { | ||
case Network.Mainnet: | ||
assetContract = 'KT1K9gCRgaLRFKTErYt1wVxA3Frb9FjasjTV'; | ||
poolContract = 'KT1AbYeDbjjcAnV1QK7EZUUdqku77CdkTuv6'; | ||
break; | ||
case Network.Delphinet: | ||
assetContract = 'KT1RXpLtz22YgX24QQhxKVyKvtKZFaAVtTB9'; | ||
poolContract = 'KT1XTUGj7Rkgh6vLVDu91h81Xu2WGfyTxpqi'; | ||
break; | ||
} | ||
super(assetContract, poolContract, toolkit, secretKey, network); | ||
this.decimals = 18; | ||
@@ -168,9 +184,17 @@ } | ||
export class TzBTC extends Token { | ||
constructor(toolkit: TezosToolkit, secretKey: string) { | ||
super( | ||
'KT1PWx2mnDueood7fEmfbBDKx1D9BAnnXitn', | ||
'KT1BGQR7t4izzKZ7eRodKWTodAsM23P38v7N', | ||
toolkit, | ||
secretKey | ||
); | ||
constructor(toolkit: TezosToolkit, secretKey: string, network: Network) { | ||
let assetContract = ''; | ||
let poolContract = ''; | ||
switch (network) { | ||
case Network.Mainnet: | ||
assetContract = 'KT1PWx2mnDueood7fEmfbBDKx1D9BAnnXitn'; | ||
poolContract = 'KT1BGQR7t4izzKZ7eRodKWTodAsM23P38v7N'; | ||
break; | ||
case Network.Delphinet: | ||
assetContract = 'KT1HeJBNHwWY18CuncPmMUVrSxurStXsMMvF'; | ||
poolContract = 'KT1QGd6nEG2Dg2LcmkpveYQ98j5b2WgePtdo'; | ||
break; | ||
} | ||
super(assetContract, poolContract, toolkit, secretKey, network); | ||
this.decimals = 8; | ||
@@ -181,9 +205,17 @@ } | ||
export class UsdTZ extends Token { | ||
constructor(toolkit: TezosToolkit, secretKey: string) { | ||
super( | ||
'KT1LN4LPSqTMS7Sd2CJw4bbDGRkMv2t68Fy9', | ||
'KT1Tr2eG3eVmPRbymrbU2UppUmKjFPXomGG9', | ||
toolkit, | ||
secretKey | ||
); | ||
constructor(toolkit: TezosToolkit, secretKey: string, network: Network) { | ||
let assetContract = ''; | ||
let poolContract = ''; | ||
switch (network) { | ||
case Network.Mainnet: | ||
assetContract = 'KT1LN4LPSqTMS7Sd2CJw4bbDGRkMv2t68Fy9'; | ||
poolContract = 'KT1Tr2eG3eVmPRbymrbU2UppUmKjFPXomGG9'; | ||
break; | ||
case Network.Delphinet: | ||
assetContract = 'KT1WvDfFgUKXWiBvQT46F8GpZ3rjQ6hLo7tz'; | ||
poolContract = 'KT1Uw3c2EgxTEVN378PaaK68jNK4DqcEuLcy'; | ||
break; | ||
} | ||
super(assetContract, poolContract, toolkit, secretKey, network); | ||
} | ||
@@ -193,9 +225,15 @@ } | ||
export class ETHtz extends Token { | ||
constructor(toolkit: TezosToolkit, secretKey: string) { | ||
super( | ||
'KT19at7rQUvyjxnZ2fBv7D9zc8rkyG7gAoU8', | ||
'KT1PDrBE59Zmxnb8vXRgRAG1XmvTMTs5EDHU', | ||
toolkit, | ||
secretKey | ||
); | ||
constructor(toolkit: TezosToolkit, secretKey: string, network: Network) { | ||
let assetContract = ''; | ||
let poolContract = ''; | ||
switch (network) { | ||
case Network.Mainnet: | ||
assetContract = 'KT19at7rQUvyjxnZ2fBv7D9zc8rkyG7gAoU8'; | ||
poolContract = 'KT1PDrBE59Zmxnb8vXRgRAG1XmvTMTs5EDHU'; | ||
break; | ||
case Network.Delphinet: | ||
throw new Error('contract not available'); | ||
} | ||
super(assetContract, poolContract, toolkit, secretKey, network); | ||
this.decimals = 18; | ||
@@ -206,4 +244,4 @@ } | ||
export class XTZ extends Token { | ||
constructor(toolkit: TezosToolkit) { | ||
super('', '', toolkit, ''); | ||
constructor(toolkit: TezosToolkit, network: Network) { | ||
super('', '', toolkit, '', network); | ||
} | ||
@@ -210,0 +248,0 @@ |
26354
535