-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PRO-2029 - PrimeSDK Code Refactor (#90)
- Loading branch information
1 parent
1934acb
commit 10e81f0
Showing
64 changed files
with
452 additions
and
1,100 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,19 @@ | ||
import { PrimeSdk } from '../src'; | ||
import { DataUtils, graphqlEndpoints } from '../src'; | ||
import * as dotenv from 'dotenv'; | ||
|
||
dotenv.config(); | ||
|
||
async function main() { | ||
// initializating sdk... | ||
const primeSdk = new PrimeSdk({ privateKey: process.env.WALLET_PRIVATE_KEY }, { | ||
chainId: Number(process.env.CHAIN_ID), | ||
projectKey: 'public-prime-testnet-key', // project key | ||
}); | ||
// initializating Data service... | ||
const dataService = new DataUtils('public-prime-testnet-key', graphqlEndpoints.QA) | ||
|
||
const balances = await primeSdk.getAccountBalances({ | ||
account: '', // account address | ||
chainId: 1, | ||
}); | ||
console.log('\x1b[33m%s\x1b[0m', `EtherspotWallet balances:`, balances); | ||
const balances = await dataService.getAccountBalances({ | ||
account: '', // address | ||
chainId: 1, | ||
}); | ||
console.log('\x1b[33m%s\x1b[0m', `EtherspotWallet balances:`, balances); | ||
} | ||
|
||
main() | ||
.catch(console.error) | ||
.finally(() => process.exit()); | ||
|
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,21 +1,17 @@ | ||
import { PrimeSdk } from '../src'; | ||
import { DataUtils, graphqlEndpoints } from '../src'; | ||
import * as dotenv from 'dotenv'; | ||
|
||
dotenv.config(); | ||
|
||
async function main(): Promise<void> { | ||
// initializating sdk... | ||
const primeSdk = new PrimeSdk({ privateKey: process.env.WALLET_PRIVATE_KEY }, { | ||
chainId: Number(process.env.CHAIN_ID), | ||
projectKey: 'public-prime-testnet-key', // project key | ||
}); | ||
const hash = '0xe6667a1185a6fd93cf082b96f78763514759041940e305da80224609bd1c6781'; | ||
const transaction = await primeSdk.getTransaction({ hash }); | ||
// initializating Data service... | ||
const dataService = new DataUtils('public-prime-testnet-key', graphqlEndpoints.QA) | ||
const hash = '0x7f8633f21d0c0c71d248333a0a2b976495015109a270a6f8a51befe3baf6fb6e'; | ||
const transaction = await dataService.getTransaction({ hash, chainId: 80001 }); | ||
|
||
console.log('\x1b[33m%s\x1b[0m', `EtherspotWallet transaction:`, transaction); | ||
} | ||
|
||
main() | ||
.catch(console.error) | ||
.finally(() => process.exit()); | ||
|
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
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,32 +1,29 @@ | ||
import { PrimeSdk } from '../src'; | ||
import { DataUtils, graphqlEndpoints } from '../src'; | ||
import * as dotenv from 'dotenv'; | ||
|
||
dotenv.config(); | ||
|
||
async function main(): Promise<void> { | ||
// initializating sdk... | ||
const primeSdk = new PrimeSdk({ privateKey: process.env.WALLET_PRIVATE_KEY }, { | ||
chainId: Number(process.env.CHAIN_ID), | ||
projectKey: 'public-prime-testnet-key', // project key | ||
}); | ||
// initializating Data service... | ||
const dataService = new DataUtils('public-prime-testnet-key', graphqlEndpoints.QA) | ||
|
||
const tokenLists = await primeSdk.getTokenLists(); | ||
const tokenLists = await dataService.getTokenLists(); | ||
|
||
console.log('\x1b[33m%s\x1b[0m', `TokenLists:`, tokenLists); | ||
console.log('\x1b[33m%s\x1b[0m', `TokenLists:`, tokenLists); | ||
|
||
const { name } = tokenLists[0]; | ||
const { name } = tokenLists[0]; | ||
|
||
let tokenListTokens = await primeSdk.getTokenListTokens(); | ||
let tokenListTokens = await dataService.getTokenListTokens(); | ||
|
||
console.log('\x1b[33m%s\x1b[0m', `Default token list tokens length:`, tokenListTokens.length); | ||
console.log('\x1b[33m%s\x1b[0m', `Default token list tokens length:`, tokenListTokens.length); | ||
|
||
tokenListTokens = await primeSdk.getTokenListTokens({ | ||
name, | ||
}); | ||
tokenListTokens = await dataService.getTokenListTokens({ | ||
name, | ||
}); | ||
|
||
console.log('\x1b[33m%s\x1b[0m', `${name} token list tokens length:`, tokenListTokens.length); | ||
console.log('\x1b[33m%s\x1b[0m', `${name} token list tokens length:`, tokenListTokens.length); | ||
} | ||
|
||
main() | ||
.catch(console.error) | ||
.finally(() => process.exit()); | ||
.catch(console.error) | ||
.finally(() => process.exit()); |
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,31 +1,28 @@ | ||
import { PrimeSdk, RateData } from '../src'; | ||
import { DataUtils, RateData, graphqlEndpoints } from '../src'; | ||
import * as dotenv from 'dotenv'; | ||
|
||
dotenv.config(); | ||
|
||
async function main(): Promise<void> { | ||
// initializating sdk... | ||
const primeSdk = new PrimeSdk({ privateKey: process.env.WALLET_PRIVATE_KEY }, { | ||
chainId: Number(process.env.CHAIN_ID), | ||
projectKey: 'public-prime-testnet-key', // project key | ||
}); | ||
// initializating Data service... | ||
const dataService = new DataUtils('public-prime-testnet-key', graphqlEndpoints.QA) | ||
|
||
const ETH_AAVE_ADDR = '0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9'; | ||
const ETH_MATIC_ADDR = '0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0'; | ||
const ETH_USDC_ADDR = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'; | ||
const TOKEN_LIST = [ETH_AAVE_ADDR, ETH_MATIC_ADDR, ETH_USDC_ADDR]; | ||
const ETH_CHAIN_ID = 1; | ||
const ETH_AAVE_ADDR = '0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9'; | ||
const ETH_MATIC_ADDR = '0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0'; | ||
const ETH_USDC_ADDR = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'; | ||
const TOKEN_LIST = [ETH_AAVE_ADDR, ETH_MATIC_ADDR, ETH_USDC_ADDR]; | ||
const ETH_CHAIN_ID = 1; | ||
|
||
const requestPayload = { | ||
tokens: TOKEN_LIST, | ||
chainId: ETH_CHAIN_ID, | ||
}; | ||
const requestPayload = { | ||
tokens: TOKEN_LIST, | ||
chainId: ETH_CHAIN_ID, | ||
}; | ||
|
||
const rates: RateData = await primeSdk.fetchExchangeRates(requestPayload); | ||
const rates: RateData = await dataService.fetchExchangeRates(requestPayload); | ||
|
||
console.log('\x1b[33m%s\x1b[0m', `EtherspotWallet Rates:`, rates); | ||
console.log('\x1b[33m%s\x1b[0m', `EtherspotWallet Rates:`, rates); | ||
} | ||
|
||
main() | ||
.catch(console.error) | ||
.finally(() => process.exit()); | ||
.catch(console.error) | ||
.finally(() => process.exit()); |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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.