Skip to content

Commit 0f02c4a

Browse files
feat: update examples to v1.51
1 parent f9ead65 commit 0f02c4a

File tree

8 files changed

+20
-58
lines changed

8 files changed

+20
-58
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ This is a Typescript project. Npm as package manager and node. Tested with npm v
2929
* `do-swap-non-evm-to-evm` (performs a cross-chain token transfer from Aptos (WETH) to Optimism ETH)
3030
* `do-swap-evm-to-non-evm` (performs a cross-chain token transfer from Optimism (ETH) to Aptos (WETH))
3131
* `get-approvals` (gets the status of an approval)
32-
* `get-chains` (gets the list of supported chains)
3332
* `get-routes` (gets a set of routes that satisfy a swap)
3433
* `get-status` (gets the status for a transaction)
3534
* `get-tokens-by-tag` (gets the list of supported tokens by specified tag)
3635
* `get-tokens` (gets the list of supported tokens)
3736
* `get-transactions` (gets the list of transactions for an address, over different chains)
3837
* `make-approvals` (creates a spend approval for an ERC20 token)
38+
* `send-transaction` 🚧 WIP 🚧
3939

4040
We also have the following utility scripts, under `src/main/utils`:
4141
* `sign-and-broadcast-transaction (utility script)` (signs and broadcasts a transaction to the blockchain)

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.43
1+
1.51

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"name": "defi-api-ts-examples",
3-
"version": "0.2.0",
3+
"version": "1.51.0",
44
"description": "",
55
"main": "main.ts",
66
"scripts": {
77
"test": "./run-all-scripts.sh",
88
"watch-tsc": "tsc --build --watch",
9-
"build": "tsc -p . --outDir ./build",
9+
"build": "pnpm exec tsc -p . --outDir ./build",
1010
"lint": "npm run format:eslint && npm run format:prettier",
1111
"format:eslint": "eslint . --fix",
1212
"format:prettier": "prettier --write --config .prettierrc.js \"./**/{*.ts,*.js}\"",
@@ -31,12 +31,11 @@
3131
"eslint-config-standard": "17.1.0",
3232
"prettier": "3.3.3",
3333
"ts-node": "10.9.2",
34-
"tsc": "2.0.4",
3534
"typescript": "5.3.3"
3635
},
3736
"dependencies": {
3837
"@aptos-labs/ts-sdk": "1.36.0",
39-
"@blockdaemon/blockdaemon-defi-api-typescript-fetch": "1.46.0",
38+
"@blockdaemon/blockdaemon-defi-api-typescript-fetch": "1.51.0",
4039
"dotenv": "16.3.1",
4140
"ethers": "6.13.5",
4241
"log4js": "6.9.1",

pnpm-lock.yaml

Lines changed: 5 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/scripts/get-approvals.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ const logger = log.getLogger(scriptName);
1111

1212
async function main() {
1313
const approvalsAPI = new ApprovalsApi(apiConfig);
14+
const chains = await approvalsAPI.getSupportedChainsForApprovals();
15+
logger.info("Got chains for approvals successfully");
16+
logger.debug(JSON.stringify(chains, null, 2));
1417

1518
const routeParameters = {
1619
fromChain: "eip155:1",
@@ -31,7 +34,7 @@ async function main() {
3134

3235
const getAllApprovalsRequest: GetAllApprovalsRequest = {
3336
chainIDs: [routeParameters.fromChain],
34-
accountAddresses: [routeParameters.fromAddress],
37+
accountAddress: routeParameters.fromAddress,
3538
};
3639
try {
3740
const allApprovals = await approvalsAPI.getAllApprovals(

src/main/scripts/get-balances.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ async function main() {
1717
};
1818

1919
try {
20+
const chains = await balancesAPI.getSupportedChainsForBalances();
21+
logger.info("Got chains for balancessuccessfully");
22+
logger.debug(JSON.stringify(chains, null, 2));
2023
const balances = await balancesAPI.getBalances(balanceRequest);
2124
logger.info("Got balances successfully");
2225
logger.debug(JSON.stringify(balances, null, 2));

src/main/scripts/get-chains.ts

Lines changed: 0 additions & 37 deletions
This file was deleted.

src/main/scripts/get-transactions.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ const MAX_REQUESTS = 3;
1313

1414
async function main() {
1515
const transactionsAPI = new TransactionsApi(apiConfig);
16+
const chains = await transactionsAPI.getSupportedChainsForTransactions();
17+
logger.info("Got chains for transactions successfully");
18+
logger.debug(JSON.stringify(chains, null, 2));
1619
let page: string | undefined = undefined;
1720
const limit = 10;
1821
let allTransactions: Transaction[] = [];

0 commit comments

Comments
 (0)