Skip to content

Commit

Permalink
feat: switched to union types for dto fields (#349)
Browse files Browse the repository at this point in the history
Co-authored-by: Nick Papirniy <[email protected]>
  • Loading branch information
npwork and Nick Papirniy authored Jan 31, 2022
1 parent 3213dbb commit 0a5f6a1
Show file tree
Hide file tree
Showing 358 changed files with 828 additions and 14,573 deletions.
11 changes: 5 additions & 6 deletions examples/bch-example/src/app/bch.ledger.example.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { TatumBchSDK } from '@tatumio/bch'
import { REPLACE_ME_WITH_TATUM_API_KEY } from '@tatumio/shared-testing'
import { Currency } from '@tatumio/shared-core'
import { CreateTrade, VirtualCurrency } from '@tatumio/api-client'

const bchSDK = TatumBchSDK({ apiKey: REPLACE_ME_WITH_TATUM_API_KEY })

Expand Down Expand Up @@ -82,7 +81,7 @@ export async function bchLedgerOrderbookExample() {
pageSize: 10,
})
const newTrade = await bchSDK.ledger.orderBook.newTrade({
type: CreateTrade.type.BUY,
type: 'BUY',
price: '8650.4',
amount: '15000',
pair: 'BCH/EUR',
Expand Down Expand Up @@ -134,18 +133,18 @@ export async function bchLedgerVirtualCurrencyExample() {
const virtualCurrencyAcc = await bchSDK.ledger.virtualCurrency.create({
name: 'VC_VIRTUAL',
supply: '1000000',
basePair: VirtualCurrency.basePair.BCH,
basePair: 'BCH',
baseRate: 1,
customer: {
accountingCurrency: VirtualCurrency.accountingCurrency.USD,
accountingCurrency: 'USD',
customerCountry: 'US',
externalId: '123654',
providerCountry: 'US',
},
description: 'My Virtual Token description.',
accountCode: 'AC_1011_B',
accountNumber: '1234567890',
accountingCurrency: VirtualCurrency.accountingCurrency.USD,
accountingCurrency: 'USD',
})
const virtualCurrency = await bchSDK.ledger.virtualCurrency.getByName('VC_VIRTUAL')
const mintTx = await bchSDK.ledger.virtualCurrency.mint({
Expand All @@ -159,6 +158,6 @@ export async function bchLedgerVirtualCurrencyExample() {
await bchSDK.ledger.virtualCurrency.update({
name: 'VC_VIRTUAL',
baseRate: 1,
basePair: VirtualCurrency.basePair.EUR,
basePair: 'EUR',
})
}
2 changes: 1 addition & 1 deletion examples/bsc-example/src/app/bsc.api.example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export async function bscApiExample() {
nonce: 0,
to: '0x687422eEA2cB73B5d3e242bA5456b782919AFc85',
// TODO openapi bug
currency: TransferBscBlockchain.currency.B2U_BSC,
currency: 'B2U_BSC',
fee: {
gasLimit: '40000',
gasPrice: '20',
Expand Down
10 changes: 5 additions & 5 deletions examples/bsc-example/src/app/bsc.ledger.example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export async function bscLedgerOrderBookExample() {
await bscSDK.ledger.orderBook.cancelByAccount('5e68c66581f2ee32bc354087')
const newTrade = await bscSDK.ledger.orderBook.newTrade({
// TODO openapi bug
type: CreateTrade.type.BUY,
type: 'BUY',
price: '8650.4',
amount: '15000',
pair: 'BSC/EUR',
Expand Down Expand Up @@ -137,11 +137,11 @@ export async function bscLedgerVirtualCurrencyExample() {
name: 'VC_VIRTUAL',
supply: '1000000',
// TODO openapi bug
basePair: VirtualCurrency.basePair.GMC_BSC,
basePair: 'GMC_BSC',
baseRate: 1,
customer: {
// TODO openapi bug
accountingCurrency: VirtualCurrency.accountingCurrency.USD,
accountingCurrency: 'USD',
customerCountry: 'US',
externalId: '123654',
providerCountry: 'US',
Expand All @@ -150,7 +150,7 @@ export async function bscLedgerVirtualCurrencyExample() {
accountCode: 'AC_1011_B',
accountNumber: '1234567890',
// TODO openapi bug
accountingCurrency: VirtualCurrency.accountingCurrency.USD,
accountingCurrency: 'USD',
})

const virtualCurrency = await bscSDK.ledger.virtualCurrency.getByName('VC_VIRTUAL')
Expand All @@ -169,6 +169,6 @@ export async function bscLedgerVirtualCurrencyExample() {
name: 'VC_VIRTUAL',
baseRate: 1,
// TODO openapi bug
basePair: VirtualCurrency.basePair.EUR,
basePair: 'EUR',
})
}
2 changes: 1 addition & 1 deletion examples/bsc-example/src/app/bsc.subscriptions.example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const bscSDK = TatumBscSDK({ apiKey: REPLACE_ME_WITH_TATUM_API_KEY })
export async function bscSubscriptionsExample() {
const id = await bscSDK.subscriptions.createSubscription({
// TODO openapi bug
type: CreateSubscriptionIncoming.type.ACCOUNT_INCOMING_BLOCKCHAIN_TRANSACTION,
type: 'ACCOUNT_INCOMING_BLOCKCHAIN_TRANSACTION',
attr: {
id: '5e6be8e9e6aa436299950c41',
url: 'https://webhook.tatum.io/account',
Expand Down
10 changes: 5 additions & 5 deletions examples/btc-example/src/app/btc.ledger.example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export async function btcLedgerOrderBookExample() {
pageSize: 10,
})
const newTrade = await btcSDK.ledger.orderBook.newTrade({
type: CreateTrade.type.BUY,
type: 'BUY',
price: '8650.4',
amount: '15000',
pair: 'BTC/EUR',
Expand Down Expand Up @@ -134,18 +134,18 @@ export async function btcLedgerVirtualCurrencyExample() {
const virtualCurrencyAcc = await btcSDK.ledger.virtualCurrency.create({
name: 'VC_VIRTUAL',
supply: '1000000',
basePair: VirtualCurrency.basePair.BTC,
basePair: 'BTC',
baseRate: 1,
customer: {
accountingCurrency: VirtualCurrency.accountingCurrency.USD,
accountingCurrency: 'USD',
customerCountry: 'US',
externalId: '123654',
providerCountry: 'US',
},
description: 'My Virtual Token description.',
accountCode: 'AC_1011_B',
accountNumber: '1234567890',
accountingCurrency: VirtualCurrency.accountingCurrency.USD,
accountingCurrency: 'USD',
})
const virtualCurrency = await btcSDK.ledger.virtualCurrency.getByName('VC_VIRTUAL')
const mintTx = await btcSDK.ledger.virtualCurrency.mint({
Expand All @@ -159,6 +159,6 @@ export async function btcLedgerVirtualCurrencyExample() {
await btcSDK.ledger.virtualCurrency.update({
name: 'VC_VIRTUAL',
baseRate: 1,
basePair: VirtualCurrency.basePair.EUR,
basePair: 'EUR',
})
}
4 changes: 2 additions & 2 deletions examples/celo-example/src/app/celo.api.example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ export async function celoApiExample() {
nonce: 0,
to: '0x687422eEA2cB73B5d3e242bA5456b782919AFc85',
// TODO openapi bug
currency: TransferCeloBlockchain.currency.CELO,
currency: 'CELO',
// TODO openapi bug
feeCurrency: TransferCeloBlockchain.feeCurrency.CELO,
feeCurrency: 'CELO',
amount: '100000',
fromPrivateKey: '0x05e150c73f1920ec14caa1e0b6aa09940899678051a785',
})
Expand Down
2 changes: 1 addition & 1 deletion examples/celo-example/src/app/celo.ledger.example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export async function celoLedgerOrderBookExample() {
await celoSDK.ledger.orderBook.cancelByAccount('5e68c66581f2ee32bc354087')
const newTrade = await celoSDK.ledger.orderBook.newTrade({
// TODO openapi bug
type: CreateTrade.type.BUY,
type: 'BUY',
price: '8650.4',
amount: '15000',
pair: 'CELO/EUR',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const celoSDK = TatumCeloSDK({ apiKey: REPLACE_ME_WITH_TATUM_API_KEY })
export async function celoSubscriptionsExample() {
const id = await celoSDK.subscriptions.createSubscription({
// TODO openapi bug
type: CreateSubscriptionIncoming.type.ACCOUNT_INCOMING_BLOCKCHAIN_TRANSACTION,
type: 'ACCOUNT_INCOMING_BLOCKCHAIN_TRANSACTION',
attr: {
id: '5e6be8e9e6aa436299950c41',
url: 'https://webhook.tatum.io/account',
Expand Down
10 changes: 5 additions & 5 deletions examples/doge-example/src/app/doge.ledger.example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export async function dogeLedgerOrderBookExample() {
pageSize: 10,
})
const newTrade = await dogeSDK.ledger.orderBook.newTrade({
type: CreateTrade.type.BUY,
type: 'BUY',
price: '8650.4',
amount: '15000',
pair: 'DOGE/EUR',
Expand Down Expand Up @@ -136,18 +136,18 @@ export async function dogeLedgerVirtualCurrencyExample() {
const virtualCurrencyAcc = await dogeSDK.ledger.virtualCurrency.create({
name: 'VC_VIRTUAL',
supply: '1000000',
basePair: VirtualCurrency.basePair.DOGE,
basePair: 'DOGE',
baseRate: 1,
customer: {
accountingCurrency: VirtualCurrency.accountingCurrency.USD,
accountingCurrency: 'USD',
customerCountry: 'US',
externalId: '123654',
providerCountry: 'US',
},
description: 'My Virtual Token description.',
accountCode: 'AC_1011_B',
accountNumber: '1234567890',
accountingCurrency: VirtualCurrency.accountingCurrency.USD,
accountingCurrency: 'USD',
})
const virtualCurrency = await dogeSDK.ledger.virtualCurrency.getByName('VC_VIRTUAL')
const mintTx = await dogeSDK.ledger.virtualCurrency.mint({
Expand All @@ -161,6 +161,6 @@ export async function dogeLedgerVirtualCurrencyExample() {
await dogeSDK.ledger.virtualCurrency.update({
name: 'VC_VIRTUAL',
baseRate: 1,
basePair: VirtualCurrency.basePair.EUR,
basePair: 'EUR',
})
}
2 changes: 1 addition & 1 deletion examples/eth-example/src/app/eth.api.example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export async function ethApiExample() {
nonce: 0,
to: '0x687422eEA2cB73B5d3e242bA5456b782919AFc85',
// TODO openapi bug
currency: TransferEthBlockchain.currency.ETH,
currency: 'ETH',
fee: {
gasLimit: '40000',
gasPrice: '20',
Expand Down
10 changes: 5 additions & 5 deletions examples/eth-example/src/app/eth.ledger.example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export async function ethLedgerOrderBookExample() {
await ethSDK.ledger.orderBook.cancelByAccount('5e68c66581f2ee32bc354087')
const newTrade = await ethSDK.ledger.orderBook.newTrade({
// TODO openapi bug
type: CreateTrade.type.BUY,
type: 'BUY',
price: '8650.4',
amount: '15000',
pair: 'ETH/EUR',
Expand Down Expand Up @@ -134,11 +134,11 @@ export async function ethLedgerVirtualCurrencyExample() {
name: 'VC_VIRTUAL',
supply: '1000000',
// TODO openapi bug
basePair: VirtualCurrency.basePair.ETH,
basePair: 'ETH',
baseRate: 1,
customer: {
// TODO openapi bug
accountingCurrency: VirtualCurrency.accountingCurrency.USD,
accountingCurrency: 'USD',
customerCountry: 'US',
externalId: '123654',
providerCountry: 'US',
Expand All @@ -147,7 +147,7 @@ export async function ethLedgerVirtualCurrencyExample() {
accountCode: 'AC_1011_B',
accountNumber: '1234567890',
// TODO openapi bug
accountingCurrency: VirtualCurrency.accountingCurrency.USD,
accountingCurrency: 'USD',
})
const virtualCurrency = await ethSDK.ledger.virtualCurrency.getByName('VC_VIRTUAL')
const mintTx = await ethSDK.ledger.virtualCurrency.mint({
Expand All @@ -162,6 +162,6 @@ export async function ethLedgerVirtualCurrencyExample() {
name: 'VC_VIRTUAL',
baseRate: 1,
// TODO openapi bug
basePair: VirtualCurrency.basePair.EUR,
basePair: 'USD',
})
}
2 changes: 1 addition & 1 deletion examples/eth-example/src/app/eth.subscriptions.example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const ethSDK = TatumEthSDK({ apiKey: REPLACE_ME_WITH_TATUM_API_KEY })
export async function ethSubscriptionsExample() {
const id = await ethSDK.subscriptions.createSubscription({
// TODO openapi bug
type: CreateSubscriptionIncoming.type.ACCOUNT_INCOMING_BLOCKCHAIN_TRANSACTION,
type: 'ACCOUNT_INCOMING_BLOCKCHAIN_TRANSACTION',
attr: {
id: '5e6be8e9e6aa436299950c41',
url: 'https://webhook.tatum.io/account',
Expand Down
2 changes: 1 addition & 1 deletion examples/kcs-example/src/app/kcs.api.example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export async function kcsApiExample() {
nonce: 0,
to: '0x687422eEA2cB73B5d3e242bA5456b782919AFc85',
// TODO openapi bug
currency: TransferKcsBlockchain.currency.KCS,
currency: 'KCS',
fee: {
gasLimit: '40000',
gasPrice: '20',
Expand Down
2 changes: 1 addition & 1 deletion examples/kcs-example/src/app/kcs.ledger.example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export async function kcsLedgerOrderBookExample() {
await kcsSDK.ledger.orderBook.cancelByAccount('5e68c66581f2ee32bc354087')
const newTrade = await kcsSDK.ledger.orderBook.newTrade({
// TODO openapi bug
type: CreateTrade.type.BUY,
type: 'BUY',
price: '8650.4',
amount: '15000',
pair: 'KCS/EUR',
Expand Down
2 changes: 1 addition & 1 deletion examples/kcs-example/src/app/kcs.subscriptions.example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const kcsSDK = TatumKcsSDK({ apiKey: REPLACE_ME_WITH_TATUM_API_KEY })
export async function kcsSubscriptionsExample() {
const id = await kcsSDK.subscriptions.createSubscription({
// TODO openapi bug
type: CreateSubscriptionIncoming.type.ACCOUNT_INCOMING_BLOCKCHAIN_TRANSACTION,
type: 'ACCOUNT_INCOMING_BLOCKCHAIN_TRANSACTION',
attr: {
id: '5e6be8e9e6aa436299950c41',
url: 'https://webhook.tatum.io/account',
Expand Down
10 changes: 5 additions & 5 deletions examples/ltc-example/src/app/ltc.ledger.example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export async function ltcLedgerOrderBookExample() {
pageSize: 10,
})
const newTrade = await ltcSDK.ledger.orderBook.newTrade({
type: CreateTrade.type.BUY,
type: 'BUY',
price: '8650.4',
amount: '15000',
pair: 'LTC/EUR',
Expand Down Expand Up @@ -134,18 +134,18 @@ export async function ltcLedgerVirtualCurrencyExample() {
const virtualCurrencyAcc = await ltcSDK.ledger.virtualCurrency.create({
name: 'VC_VIRTUAL',
supply: '1000000',
basePair: VirtualCurrency.basePair.LTC,
basePair: 'LTC',
baseRate: 1,
customer: {
accountingCurrency: VirtualCurrency.accountingCurrency.USD,
accountingCurrency: 'USD',
customerCountry: 'US',
externalId: '123654',
providerCountry: 'US',
},
description: 'My Virtual Token description.',
accountCode: 'AC_1011_B',
accountNumber: '1234567890',
accountingCurrency: VirtualCurrency.accountingCurrency.USD,
accountingCurrency: 'USD',
})
const virtualCurrency = await ltcSDK.ledger.virtualCurrency.getByName('VC_VIRTUAL')
const mintTx = await ltcSDK.ledger.virtualCurrency.mint({
Expand All @@ -159,6 +159,6 @@ export async function ltcLedgerVirtualCurrencyExample() {
await ltcSDK.ledger.virtualCurrency.update({
name: 'VC_VIRTUAL',
baseRate: 1,
basePair: VirtualCurrency.basePair.EUR,
basePair: 'EUR',
})
}
2 changes: 1 addition & 1 deletion examples/one-example/src/app/one.api.example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export async function oneApiExample() {
nonce: 0,
to: '0x687422eEA2cB73B5d3e242bA5456b782919AFc85',
// TODO openapi bug
currency: TransferOneBlockchain.currency.ONE,
currency: 'ONE',
fee: {
gasLimit: '40000',
gasPrice: '20',
Expand Down
2 changes: 1 addition & 1 deletion examples/one-example/src/app/one.ledger.example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export async function oneLedgerOrderBookExample() {
await oneSDK.ledger.orderBook.cancelByAccount('5e68c66581f2ee32bc354087')
const newTrade = await oneSDK.ledger.orderBook.newTrade({
// TODO openapi bug
type: CreateTrade.type.BUY,
type: 'BUY',
price: '8650.4',
amount: '15000',
pair: 'ONE/EUR',
Expand Down
2 changes: 1 addition & 1 deletion examples/one-example/src/app/one.subscriptions.example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const oneSDK = TatumOneSDK({ apiKey: REPLACE_ME_WITH_TATUM_API_KEY })
export async function oneSubscriptionsExample() {
const id = await oneSDK.subscriptions.createSubscription({
// TODO openapi bug
type: CreateSubscriptionIncoming.type.ACCOUNT_INCOMING_BLOCKCHAIN_TRANSACTION,
type: 'ACCOUNT_INCOMING_BLOCKCHAIN_TRANSACTION',
attr: {
id: '5e6be8e9e6aa436299950c41',
url: 'https://webhook.tatum.io/account',
Expand Down
2 changes: 1 addition & 1 deletion examples/polygon-example/src/app/polygon.api.example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export async function polygonApiExample() {
data: 'My note to recipient.',
nonce: 0,
to: '0x687422eEA2cB73B5d3e242bA5456b782919AFc85',
currency: TransferPolygonBlockchain.currency.MATIC,
currency: 'MATIC',
amount: '100000',
fromPrivateKey: '0x05e150c73f1920ec14caa1e0b6aa09940899678051a785',
})
Expand Down
Loading

0 comments on commit 0a5f6a1

Please sign in to comment.