-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SDK implementation of assets analytics using dex guru (#218)
* SDK implementation of assets analytics using dex guru * Allowing dynamic chain idon fly
- Loading branch information
1 parent
0d15433
commit ed8716f
Showing
29 changed files
with
916 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { EnvNames, NetworkNames, Sdk } from '../../src'; | ||
import { logger } from './common'; | ||
|
||
async function main(): Promise<void> { | ||
const PRIVATE_KEY = ''; //Privite key Example: get from metamask | ||
|
||
const sdk = new Sdk(PRIVATE_KEY, { env: EnvNames.LocalNets, networkName: NetworkNames.Mainnet }); | ||
|
||
const { state } = sdk; | ||
|
||
logger.log('key account', state.account); | ||
|
||
logger.log( | ||
'contract account', | ||
await sdk.computeContractAccount({ | ||
sync: false, | ||
}), | ||
); | ||
|
||
await sdk.syncAccount(); | ||
|
||
logger.log('synced contract account', state.account); | ||
logger.log('synced contract account member', state.accountMember); | ||
|
||
logger.log( | ||
'get token details', | ||
await sdk.getTokenDetails({ | ||
chainId: 1, //Linked chain id | ||
tokenAddress: '0xdAC17F958D2ee523a2206206994597C13D831ec7', | ||
provider: '', //specific provider optional | ||
}) | ||
); | ||
} | ||
|
||
main() | ||
.catch(logger.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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { EnvNames, NetworkNames, Sdk } from '../../src'; | ||
import { logger } from './common'; | ||
|
||
async function main(): Promise<void> { | ||
const PRIVATE_KEY = ''; //Privite key Example: get from metamask | ||
|
||
const sdk = new Sdk(PRIVATE_KEY, { env: EnvNames.LocalNets, networkName: NetworkNames.Mainnet }); | ||
|
||
const { state } = sdk; | ||
|
||
logger.log('key account', state.account); | ||
|
||
logger.log( | ||
'contract account', | ||
await sdk.computeContractAccount({ | ||
sync: false, | ||
}), | ||
); | ||
|
||
await sdk.syncAccount(); | ||
|
||
logger.log('synced contract account', state.account); | ||
logger.log('synced contract account member', state.accountMember); | ||
|
||
logger.log( | ||
'get historical token price', | ||
await sdk.getHistoricalTokenPrice({ | ||
chainId: 1, //Linked chain id | ||
tokenAddress: '0xdAC17F958D2ee523a2206206994597C13D831ec7', | ||
provider: '', //specific provider optional | ||
timePeriod: '1week', //specific time period optional | ||
}) | ||
); | ||
} | ||
|
||
main() | ||
.catch(logger.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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { EnvNames, NetworkNames, Sdk } from '../../src'; | ||
import { logger } from './common'; | ||
|
||
async function main(): Promise<void> { | ||
const PRIVATE_KEY = ''; //Privite key Example: get from metamask | ||
|
||
const sdk = new Sdk(PRIVATE_KEY, { env: EnvNames.LocalNets, networkName: NetworkNames.Mainnet }); | ||
|
||
const { state } = sdk; | ||
|
||
logger.log('key account', state.account); | ||
|
||
logger.log( | ||
'contract account', | ||
await sdk.computeContractAccount({ | ||
sync: false, | ||
}), | ||
); | ||
|
||
await sdk.syncAccount(); | ||
|
||
logger.log('synced contract account', state.account); | ||
logger.log('synced contract account member', state.accountMember); | ||
|
||
logger.log( | ||
'get pools activity of token', | ||
await sdk.getPoolsActivity({ | ||
chainId: 1, //Linked chain id | ||
tokenAddress: '0xdAC17F958D2ee523a2206206994597C13D831ec7', | ||
provider: '', //specific provider optional | ||
page: 1, | ||
type: "adds", | ||
}) | ||
); | ||
} | ||
|
||
main() | ||
.catch(logger.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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { EnvNames, NetworkNames, Sdk } from '../../src'; | ||
import { logger } from './common'; | ||
|
||
async function main(): Promise<void> { | ||
const PRIVATE_KEY = ''; //Privite key Example: get from metamask | ||
|
||
const sdk = new Sdk(PRIVATE_KEY, { env: EnvNames.LocalNets, networkName: NetworkNames.Mainnet }); | ||
|
||
const { state } = sdk; | ||
|
||
logger.log('key account', state.account); | ||
|
||
logger.log( | ||
'contract account', | ||
await sdk.computeContractAccount({ | ||
sync: false, | ||
}), | ||
); | ||
|
||
await sdk.syncAccount(); | ||
|
||
logger.log('synced contract account', state.account); | ||
logger.log('synced contract account member', state.accountMember); | ||
|
||
logger.log( | ||
'get number of transactions of token', | ||
await sdk.getNumberOfTransactions({ | ||
chainId: 1, //Linked chain id | ||
tokenAddress: '0xdAC17F958D2ee523a2206206994597C13D831ec7', | ||
provider: '', //specific provider optional | ||
}) | ||
); | ||
} | ||
|
||
main() | ||
.catch(logger.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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { EnvNames, NetworkNames, Sdk } from '../../src'; | ||
import { logger } from './common'; | ||
|
||
async function main(): Promise<void> { | ||
const PRIVATE_KEY = ''; //Privite key Example: get from metamask | ||
|
||
const sdk = new Sdk(PRIVATE_KEY, { env: EnvNames.LocalNets, networkName: NetworkNames.Mainnet }); | ||
|
||
const { state } = sdk; | ||
|
||
logger.log('key account', state.account); | ||
|
||
logger.log( | ||
'contract account', | ||
await sdk.computeContractAccount({ | ||
sync: false, | ||
}), | ||
); | ||
|
||
await sdk.syncAccount(); | ||
|
||
logger.log('synced contract account', state.account); | ||
logger.log('synced contract account member', state.accountMember); | ||
|
||
logger.log( | ||
'get trading history of token', | ||
await sdk.getTradingHistory({ | ||
chainId: 1, //Linked chain id | ||
tokenAddress: '0xdAC17F958D2ee523a2206206994597C13D831ec7', | ||
provider: '', //specific provider optional | ||
page: 1, //offset of records optional | ||
}) | ||
); | ||
} | ||
|
||
main() | ||
.catch(logger.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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { EnvNames, NetworkNames, Sdk } from '../../src'; | ||
import { logger } from './common'; | ||
|
||
async function main(): Promise<void> { | ||
const PRIVATE_KEY = ''; //Privite key Example: get from metamask | ||
|
||
const sdk = new Sdk(PRIVATE_KEY, { env: EnvNames.LocalNets, networkName: NetworkNames.Mainnet }); | ||
|
||
const { state } = sdk; | ||
|
||
logger.log('key account', state.account); | ||
|
||
logger.log( | ||
'contract account', | ||
await sdk.computeContractAccount({ | ||
sync: false, | ||
}), | ||
); | ||
|
||
await sdk.syncAccount(); | ||
|
||
logger.log('synced contract account', state.account); | ||
logger.log('synced contract account member', state.accountMember); | ||
|
||
logger.log( | ||
'get market details of token', | ||
await sdk.getMarketDetails({ | ||
chainId: 1, //Linked chain id | ||
tokenAddress: '0xdAC17F958D2ee523a2206206994597C13D831ec7', | ||
provider: '', //specific provider optional | ||
}) | ||
); | ||
} | ||
|
||
main() | ||
.catch(logger.error) | ||
.finally(() => process.exit()); |
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
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.