-
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.
* Added data wapper and new endpoints * Added project-key validation on data-wrapper endpoints and fixed linting check * updated package version * fixed linting errors
- Loading branch information
1 parent
cc224d9
commit b32597d
Showing
87 changed files
with
4,120 additions
and
226 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
node_modules | ||
dist | ||
coverage | ||
__snapshots__ | ||
__snapshots__ | ||
src/sdk/contracts/**/*.ts |
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { PrimeSdk } 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: '', // project key | ||
}); | ||
|
||
const balances = await primeSdk.getAccountBalances({ | ||
account: '', // 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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { PrimeSdk } 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: '', // project key | ||
}); | ||
const hash = '0xe6667a1185a6fd93cf082b96f78763514759041940e305da80224609bd1c6781'; | ||
const transaction = await primeSdk.getTransaction({ hash }); | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { PrimeSdk } 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: '', // project key | ||
}); | ||
const chainId = 1; | ||
const account = ''; // account address | ||
const transactions = await primeSdk.getTransactions({ chainId, account }); | ||
|
||
console.log('\x1b[33m%s\x1b[0m', `EtherspotWallet transactions:`, transactions); | ||
} | ||
|
||
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { PrimeSdk } 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: '', // project key | ||
}); | ||
const chainId = 137; | ||
const account = ''; // account address | ||
const nfts = await primeSdk.getNftList({ chainId, account }); | ||
|
||
console.log('\x1b[33m%s\x1b[0m', `EtherspotWallet nfts:`, nfts); | ||
} | ||
|
||
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { PrimeSdk } from '../src'; | ||
import * as dotenv from 'dotenv'; | ||
import { BigNumber, constants } from 'ethers'; | ||
|
||
dotenv.config(); | ||
|
||
async function main(): Promise<void> { | ||
const primeSdk = new PrimeSdk({ privateKey: process.env.WALLET_PRIVATE_KEY }, { | ||
chainId: Number(process.env.CHAIN_ID), | ||
projectKey: '', // project key | ||
}); | ||
const fromTokenAddress = '0xe3818504c1b32bf1557b16c238b2e01fd3149c17'; | ||
const toTokenAddress = constants.AddressZero; | ||
const fromAmount = '1000000000000000000'; | ||
const fromChainId = 1; | ||
|
||
const offers = await primeSdk.getExchangeOffers({ | ||
fromChainId, | ||
fromTokenAddress, | ||
toTokenAddress, | ||
fromAmount: BigNumber.from(fromAmount), | ||
}); | ||
|
||
console.log('\x1b[33m%s\x1b[0m', `Exchange offers:`, offers); | ||
} | ||
|
||
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { ethers, utils } from 'ethers'; | ||
import { PrimeSdk } 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: '', // project key | ||
}); | ||
|
||
const fromChainId = 56; | ||
const toChainId = 137; | ||
|
||
const fromAmount = utils.parseUnits('1', 18); | ||
|
||
const quoteRequestPayload = { | ||
fromChainId: fromChainId, | ||
toChainId: toChainId, | ||
fromTokenAddress: ethers.constants.AddressZero, | ||
toTokenAddress: ethers.constants.AddressZero, | ||
fromAmount: fromAmount, | ||
}; | ||
|
||
const quotes = await primeSdk.getAdvanceRoutesLiFi(quoteRequestPayload); | ||
|
||
console.log('\x1b[33m%s\x1b[0m', `Quotes:`, quotes.items); | ||
|
||
if (quotes.items.length > 0) { | ||
const quote = quotes.items[0]; // Selected the first route | ||
const transactions = await primeSdk.getStepTransaction({ route: quote }); | ||
|
||
console.log('\x1b[33m%s\x1b[0m', `transactions:`, transactions); | ||
} | ||
} | ||
|
||
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { utils } from 'ethers'; | ||
import { PrimeSdk } from '../src'; | ||
import * as dotenv from 'dotenv'; | ||
import { BridgingQuotes, CrossChainServiceProvider } from '../src/sdk/data'; | ||
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: '', // project key | ||
}); | ||
|
||
const XdaiUSDC = '0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83'; // Xdai - USDC | ||
const MaticUSDC = '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174'; // Matic - USDC | ||
|
||
const fromChainId = 137; | ||
const toChainId = 100; | ||
const fromTokenAddress: string = MaticUSDC; | ||
const toTokenAddress: string = XdaiUSDC; | ||
|
||
// MATIC USDC has 6 decimals | ||
const fromAmount = utils.parseUnits('1', 6); // 10 USDC | ||
|
||
const quoteRequestPayload = { | ||
fromChainId: fromChainId, | ||
toChainId: toChainId, | ||
fromTokenAddress: fromTokenAddress, | ||
toTokenAddress: toTokenAddress, | ||
fromAddress: '', // account address | ||
fromAmount: fromAmount, | ||
serviceProvider: CrossChainServiceProvider.LiFi, // Optional parameter | ||
}; | ||
|
||
const quotes: BridgingQuotes = await primeSdk.getCrossChainQuotes(quoteRequestPayload); | ||
|
||
console.log('\x1b[33m%s\x1b[0m', `Quotes:`, quotes); | ||
} | ||
|
||
main() | ||
.catch(console.error) | ||
.finally(() => process.exit()); |
Oops, something went wrong.