@axonfi/sdk 0.15.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -429,7 +429,7 @@ Supports EIP-3009 (USDC, gasless) and Permit2 (any ERC-20) settlement schemes.
429
429
  - [Documentation](https://axonfi.xyz/llms.txt)
430
430
  - [npm — @axonfi/sdk](https://www.npmjs.com/package/@axonfi/sdk)
431
431
  - [PyPI — axonfi](https://pypi.org/project/axonfi/) (Python SDK)
432
- - [Smart Contracts](https://github.com/axonfi/smart-contracts)
432
+ - [Smart Contracts](https://github.com/axonfi/core)
433
433
  - [Examples](https://github.com/axonfi/examples)
434
434
  - [Twitter/X — @axonfixyz](https://x.com/axonfixyz)
435
435
 
package/dist/index.cjs CHANGED
@@ -134,6 +134,8 @@ var RELAYER_API = {
134
134
  protocolCheck: (vault, protocol, chainId) => `/v1/vault/${vault}/protocol/${protocol}?chainId=${chainId}`,
135
135
  rebalanceTokens: (vault, chainId) => `/v1/vault/${vault}/rebalance-tokens?chainId=${chainId}`,
136
136
  rebalanceTokenCheck: (vault, token, chainId) => `/v1/vault/${vault}/rebalance-token/${token}?chainId=${chainId}`,
137
+ // Vault value endpoint
138
+ vaultValue: (vault, chainId) => `/v1/vault/${vault}/value?chainId=${chainId}`,
137
139
  // TOS endpoints
138
140
  tosStatus: (wallet) => `/v1/tos/status?wallet=${wallet}`,
139
141
  TOS_ACCEPT: "/v1/tos/accept"
@@ -3533,13 +3535,11 @@ async function deployVault(walletClient, publicClient, relayerUrl) {
3533
3535
  chain: walletClient.chain ?? null
3534
3536
  });
3535
3537
  const receipt = await publicClient.waitForTransactionReceipt({ hash });
3538
+ const vaultDeployedSig = "0x42315f4340c2734f2a8ef1b71fd45068eafc3ed5730a08a98e8d7ef57105626a";
3536
3539
  for (const log of receipt.logs) {
3537
- try {
3538
- if (log.topics.length >= 3 && log.topics[2]) {
3539
- const vaultAddress = `0x${log.topics[2].slice(26)}`;
3540
- return vaultAddress;
3541
- }
3542
- } catch {
3540
+ if (log.topics.length >= 3 && log.topics[0] === vaultDeployedSig && log.topics[2]) {
3541
+ const vaultAddress = `0x${log.topics[2].slice(26)}`;
3542
+ return vaultAddress;
3543
3543
  }
3544
3544
  }
3545
3545
  throw new Error("VaultDeployed event not found in transaction receipt");
@@ -4191,6 +4191,19 @@ var AxonClient = class {
4191
4191
  return this._get(path);
4192
4192
  }
4193
4193
  // ============================================================================
4194
+ // getVaultValue() — via relayer
4195
+ // ============================================================================
4196
+ /**
4197
+ * Returns the total USD value of the vault with a per-token breakdown (via relayer).
4198
+ *
4199
+ * Includes all ERC-20 holdings with non-zero balances, their USD prices,
4200
+ * and the aggregate vault value.
4201
+ */
4202
+ async getVaultValue() {
4203
+ const path = RELAYER_API.vaultValue(this.vaultAddress, this.chainId);
4204
+ return this._get(path);
4205
+ }
4206
+ // ============================================================================
4194
4207
  // canPayTo() — via relayer
4195
4208
  // ============================================================================
4196
4209
  /**