-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9f980e7
commit cd57cc4
Showing
17 changed files
with
116 additions
and
154 deletions.
There are no files selected for viewing
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
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,13 +1,9 @@ | ||
(async () => { | ||
const { TradingWalletService } = require('@eidoo/hybrid-exchange-sdk').services | ||
const Web3 = require('web3') | ||
const { TradingWalletServiceBuilder } = require('@eidoo/hybrid-exchange-sdk').factories | ||
|
||
const providerUrl = 'providerUrl' | ||
const web3 = new Web3(new Web3.providers.HttpProvider(providerUrl)) | ||
const tradingWalletService = new TradingWalletService(web3) | ||
|
||
const personalWalletAddress = '0x70742a2530069fd1fa302766e2e58f7c03d63e4e' | ||
const tradingWalletService = TradingWalletServiceBuilder.build() | ||
|
||
const personalWalletAddress = '0xcf4b07a79b5d29988f488f30c4a676ecaad35c02' | ||
const tradingWalletAddress = await tradingWalletService.getTradingWalletAddressAsync(personalWalletAddress) | ||
console.log(tradingWalletAddress) | ||
})() |
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
const Web3 = require('web3') | ||
|
||
const logger = require('../logger') | ||
const Erc20TokenTransactionBuilder = require('./Erc20TokenTransactionBuilder') | ||
|
||
const { TransactionLib } = require('../lib/TransactionLib') | ||
const { Erc20TokenService } = require('../services') | ||
|
||
const providerUrl = 'urlToProvider' | ||
const web3 = new Web3(new Web3.providers.HttpProvider(providerUrl)) | ||
|
||
const transactionLibInstance = new TransactionLib(web3, logger) | ||
|
||
/** | ||
* Class representing a simple factory to build Erc20TokenService object. | ||
*/ | ||
|
||
class Erc20TokenServiceBuilder { | ||
constructor(tokenAddress) { | ||
if (!tokenAddress) { | ||
const errorMessage = `Invalid "tokenAddress" value: ${tokenAddress}` | ||
throw new TypeError(errorMessage) | ||
} | ||
|
||
this.tokenAddress = tokenAddress | ||
} | ||
|
||
build() { | ||
const erc20TokenTransactionBuilder = new Erc20TokenTransactionBuilder( | ||
web3, | ||
{ erc20TokenSmartContractAddress: this.tokenAddress, | ||
transactionLib: transactionLibInstance }, | ||
logger, | ||
) | ||
return new Erc20TokenService(web3, transactionLibInstance, erc20TokenTransactionBuilder, logger) | ||
} | ||
} | ||
|
||
module.exports = Erc20TokenServiceBuilder |
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,24 @@ | ||
const Web3 = require('web3') | ||
|
||
const logger = require('../logger') | ||
const TradingWalletTransactionBuilder = require('./TradingWalletTransactionBuilder') | ||
|
||
const { TransactionLib } = require('../lib/TransactionLib') | ||
const { TradingWalletService } = require('../services') | ||
|
||
const providerUrl = 'urlToProvider' | ||
const web3 = new Web3(new Web3.providers.HttpProvider(providerUrl)) | ||
const transactionLibInstance = new TransactionLib(web3, logger) | ||
|
||
/** | ||
* Class representing a simple factory to build TradingWalletService object. | ||
*/ | ||
|
||
class TradingWalletServiceBuilder { | ||
static build() { | ||
const tradingWalletTransactionBuilder = new TradingWalletTransactionBuilder(web3) | ||
return new TradingWalletService(web3, transactionLibInstance, tradingWalletTransactionBuilder, logger) | ||
} | ||
} | ||
|
||
module.exports = TradingWalletServiceBuilder |
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,9 +1,13 @@ | ||
const Erc20TokenTransactionBuilder = require('./Erc20TokenTransactionBuilder') | ||
const Erc20TokenServiceBuilder = require('./Erc20TokenServiceBuilder') | ||
const OrderPayloadBuilder = require('./OrderPayloadBuilder') | ||
const TradingWalletServiceBuilder = require('./TradingWalletServiceBuilder') | ||
const TradingWalletTransactionBuilder = require('./TradingWalletTransactionBuilder') | ||
|
||
module.exports = { | ||
Erc20TokenTransactionBuilder, | ||
Erc20TokenServiceBuilder, | ||
OrderPayloadBuilder, | ||
TradingWalletServiceBuilder, | ||
TradingWalletTransactionBuilder, | ||
} |
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.