Skip to content

Commit

Permalink
#11 Add Example
Browse files Browse the repository at this point in the history
  • Loading branch information
ceres3idoo committed Feb 18, 2019
1 parent 1f1a916 commit a67d009
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
3 changes: 2 additions & 1 deletion examples/lib/tradingWallet/depositToken/depositToken.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
(async () => {
const { TradingWalletServiceBuilder } = require('@eidoo/hybrid-exchange-sdk').factories
// const { TradingWalletServiceBuilder } = require('@eidoo/hybrid-exchange-sdk').factories
const { TradingWalletServiceBuilder } = require('../../../../index').factories

const tradingWalletService = TradingWalletServiceBuilder.build()

Expand Down
24 changes: 24 additions & 0 deletions examples/lib/tradingWallet/depositToken/depositTokenWithApprove.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
(async () => {
// const { TradingWalletServiceBuilder } = require('@eidoo/hybrid-exchange-sdk').factories
// const { TradingWalletFacade } = require('@eidoo/hybrid-exchange-sdk').facades

const { Erc20TokenServiceBuilder, TradingWalletServiceBuilder } = require('../../../../index').factories
const { TradingWalletFacade } = require('../../../../index').facades

const tokenAddress = '0x9727e2fb13f7f42d5a6f1a4a9877d4a7e0404d6a'
const personalWalletAddress = '0xcf4b07a79b5d29988f488f30c4a676ecaad35c02'
const tradingWalletAddress = '0x9c6d1840381cc570235a4ed867bf8465e32ce753'
const privateKey = '0x4c7ee440ad699493b22732031e4a3277d2d8aa834b727aa0b358e3310aa37384'
const quantityToDeposit = '500000000000000000'

const erc20TokenServiceBuilder = new Erc20TokenServiceBuilder(tokenAddress)
const tradingWalletFacade = new TradingWalletFacade(TradingWalletServiceBuilder.build(), erc20TokenServiceBuilder.build())

await tradingWalletFacade.depositTokenAsync(
personalWalletAddress,
tradingWalletAddress,
quantityToDeposit,
tokenAddress,
privateKey,
)
})()

0 comments on commit a67d009

Please sign in to comment.