upshift-config 0.5.14
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/LICENSE +21 -0
- package/README.md +349 -0
- package/lib/abis/AddressResolver.d.ts +28 -0
- package/lib/abis/AddressResolver.js +23 -0
- package/lib/abis/ChainlinkV3.d.ts +87 -0
- package/lib/abis/ChainlinkV3.js +117 -0
- package/lib/abis/ERC20.d.ts +168 -0
- package/lib/abis/ERC20.js +226 -0
- package/lib/abis/ERC20_Bytes32.d.ts +139 -0
- package/lib/abis/ERC20_Bytes32.js +196 -0
- package/lib/abis/ERC4626.d.ts +364 -0
- package/lib/abis/ERC4626.js +507 -0
- package/lib/abis/ERC721.d.ts +231 -0
- package/lib/abis/ERC721.js +321 -0
- package/lib/abis/FeeOracle.d.ts +120 -0
- package/lib/abis/FeeOracle.js +162 -0
- package/lib/abis/LendingPool.d.ts +1393 -0
- package/lib/abis/LendingPool.js +1807 -0
- package/lib/abis/LendingPoolV2.d.ts +1413 -0
- package/lib/abis/LendingPoolV2.js +1833 -0
- package/lib/abis/LendingPoolV3.d.ts +1677 -0
- package/lib/abis/LendingPoolV3.js +1160 -0
- package/lib/abis/Loan.d.ts +837 -0
- package/lib/abis/Loan.js +1080 -0
- package/lib/abis/MultiAssetNativeDepositWrapper.d.ts +137 -0
- package/lib/abis/MultiAssetNativeDepositWrapper.js +125 -0
- package/lib/abis/Multicall3.d.ts +30 -0
- package/lib/abis/Multicall3.js +97 -0
- package/lib/abis/OFT.d.ts +116 -0
- package/lib/abis/OFT.js +85 -0
- package/lib/abis/PoolAdapter.d.ts +36 -0
- package/lib/abis/PoolAdapter.js +51 -0
- package/lib/abis/RewardDistributor.d.ts +267 -0
- package/lib/abis/RewardDistributor.js +352 -0
- package/lib/abis/RwaRedeemSubaccount.d.ts +747 -0
- package/lib/abis/RwaRedeemSubaccount.js +548 -0
- package/lib/abis/SmartAccount.d.ts +17 -0
- package/lib/abis/SmartAccount.js +19 -0
- package/lib/abis/SwapRouter.d.ts +1043 -0
- package/lib/abis/SwapRouter.js +740 -0
- package/lib/abis/TextResolver.d.ts +16 -0
- package/lib/abis/TextResolver.js +16 -0
- package/lib/abis/TokenizedVaultV2.d.ts +1364 -0
- package/lib/abis/TokenizedVaultV2.js +1041 -0
- package/lib/abis/TokenizedVaultV2DepositWithPermit.d.ts +1456 -0
- package/lib/abis/TokenizedVaultV2DepositWithPermit.js +1878 -0
- package/lib/abis/TokenizedVaultV2Receipt.d.ts +1568 -0
- package/lib/abis/TokenizedVaultV2Receipt.js +1061 -0
- package/lib/abis/TokenizedVaultV2SenderAllocationWhitelist.d.ts +454 -0
- package/lib/abis/TokenizedVaultV2SenderAllocationWhitelist.js +327 -0
- package/lib/abis/TokenizedVaultV2WhitelistedAllocation.d.ts +1466 -0
- package/lib/abis/TokenizedVaultV2WhitelistedAllocation.js +1092 -0
- package/lib/abis/TokenizedVaultV2WhitelistedAssets.d.ts +274 -0
- package/lib/abis/TokenizedVaultV2WhitelistedAssets.js +167 -0
- package/lib/abis/UniversalResolverResolve.d.ts +69 -0
- package/lib/abis/UniversalResolverResolve.js +35 -0
- package/lib/abis/UniversalSignatureValidator.d.ts +17 -0
- package/lib/abis/UniversalSignatureValidator.js +30 -0
- package/lib/abis/WrapperAdapter.d.ts +71 -0
- package/lib/abis/WrapperAdapter.js +77 -0
- package/lib/abis/index.d.ts +34 -0
- package/lib/abis/index.js +51 -0
- package/lib/adapters/evm/getters.d.ts +19 -0
- package/lib/adapters/evm/getters.js +209 -0
- package/lib/adapters/evm/index.d.ts +353 -0
- package/lib/adapters/evm/index.js +434 -0
- package/lib/adapters/evm/utils.d.ts +8 -0
- package/lib/adapters/evm/utils.js +51 -0
- package/lib/adapters/solana/constants.d.ts +33 -0
- package/lib/adapters/solana/constants.js +52 -0
- package/lib/adapters/solana/getters.d.ts +11 -0
- package/lib/adapters/solana/getters.js +165 -0
- package/lib/adapters/solana/idl/vault-idl.d.ts +272 -0
- package/lib/adapters/solana/idl/vault-idl.js +1084 -0
- package/lib/adapters/solana/index.d.ts +233 -0
- package/lib/adapters/solana/index.js +291 -0
- package/lib/adapters/solana/types.d.ts +67 -0
- package/lib/adapters/solana/types.js +3 -0
- package/lib/adapters/solana/utils.d.ts +141 -0
- package/lib/adapters/solana/utils.js +595 -0
- package/lib/adapters/solana/vault.actions.d.ts +57 -0
- package/lib/adapters/solana/vault.actions.js +379 -0
- package/lib/adapters/stellar/actions.d.ts +28 -0
- package/lib/adapters/stellar/actions.js +77 -0
- package/lib/adapters/stellar/constants.d.ts +43 -0
- package/lib/adapters/stellar/constants.js +53 -0
- package/lib/adapters/stellar/getters.d.ts +68 -0
- package/lib/adapters/stellar/getters.js +290 -0
- package/lib/adapters/stellar/index.d.ts +114 -0
- package/lib/adapters/stellar/index.js +175 -0
- package/lib/adapters/stellar/soroban.d.ts +123 -0
- package/lib/adapters/stellar/soroban.js +613 -0
- package/lib/adapters/stellar/submit.d.ts +34 -0
- package/lib/adapters/stellar/submit.js +149 -0
- package/lib/adapters/stellar/types.d.ts +58 -0
- package/lib/adapters/stellar/types.js +6 -0
- package/lib/adapters/stellar/utils.d.ts +24 -0
- package/lib/adapters/stellar/utils.js +34 -0
- package/lib/adapters/sui/constants.d.ts +14 -0
- package/lib/adapters/sui/constants.js +29 -0
- package/lib/adapters/sui/getters.d.ts +9 -0
- package/lib/adapters/sui/getters.js +60 -0
- package/lib/adapters/sui/index.d.ts +45 -0
- package/lib/adapters/sui/index.js +101 -0
- package/lib/adapters/sui/transformer.d.ts +10 -0
- package/lib/adapters/sui/transformer.js +107 -0
- package/lib/adapters/sui/types.d.ts +66 -0
- package/lib/adapters/sui/types.js +3 -0
- package/lib/adapters/sui/utils.d.ts +10 -0
- package/lib/adapters/sui/utils.js +29 -0
- package/lib/core/analytics/chain-name.d.ts +9 -0
- package/lib/core/analytics/chain-name.js +34 -0
- package/lib/core/analytics/constants.d.ts +5 -0
- package/lib/core/analytics/constants.js +9 -0
- package/lib/core/analytics/env.d.ts +29 -0
- package/lib/core/analytics/env.js +59 -0
- package/lib/core/analytics/index.d.ts +36 -0
- package/lib/core/analytics/index.js +79 -0
- package/lib/core/analytics/instrumentation.d.ts +29 -0
- package/lib/core/analytics/instrumentation.js +277 -0
- package/lib/core/analytics/method-taxonomy.d.ts +19 -0
- package/lib/core/analytics/method-taxonomy.js +128 -0
- package/lib/core/analytics/metrics.d.ts +33 -0
- package/lib/core/analytics/metrics.js +116 -0
- package/lib/core/analytics/sanitize.d.ts +44 -0
- package/lib/core/analytics/sanitize.js +260 -0
- package/lib/core/analytics/sentry-runtime.d.ts +15 -0
- package/lib/core/analytics/sentry-runtime.js +97 -0
- package/lib/core/analytics/sentry.d.ts +67 -0
- package/lib/core/analytics/sentry.js +613 -0
- package/lib/core/analytics/types.d.ts +48 -0
- package/lib/core/analytics/types.js +3 -0
- package/lib/core/analytics/user-identity.d.ts +41 -0
- package/lib/core/analytics/user-identity.js +141 -0
- package/lib/core/analytics/version.d.ts +6 -0
- package/lib/core/analytics/version.js +10 -0
- package/lib/core/attribution.d.ts +111 -0
- package/lib/core/attribution.js +142 -0
- package/lib/core/auth/index.d.ts +1 -0
- package/lib/core/auth/index.js +18 -0
- package/lib/core/auth/verify.d.ts +2 -0
- package/lib/core/auth/verify.js +31 -0
- package/lib/core/base.class.d.ts +152 -0
- package/lib/core/base.class.js +172 -0
- package/lib/core/cache.d.ts +9 -0
- package/lib/core/cache.js +31 -0
- package/lib/core/constants/adapters.d.ts +103 -0
- package/lib/core/constants/adapters.js +180 -0
- package/lib/core/constants/core.d.ts +133 -0
- package/lib/core/constants/core.js +209 -0
- package/lib/core/constants/swap-router.d.ts +150 -0
- package/lib/core/constants/swap-router.js +169 -0
- package/lib/core/constants/vaults.d.ts +93 -0
- package/lib/core/constants/vaults.js +273 -0
- package/lib/core/constants/web3.d.ts +91 -0
- package/lib/core/constants/web3.js +229 -0
- package/lib/core/errors/index.d.ts +114 -0
- package/lib/core/errors/index.js +183 -0
- package/lib/core/fetcher.d.ts +198 -0
- package/lib/core/fetcher.js +903 -0
- package/lib/core/helpers/adapters.d.ts +13 -0
- package/lib/core/helpers/adapters.js +39 -0
- package/lib/core/helpers/chain-address.d.ts +13 -0
- package/lib/core/helpers/chain-address.js +47 -0
- package/lib/core/helpers/chain-error.d.ts +207 -0
- package/lib/core/helpers/chain-error.js +682 -0
- package/lib/core/helpers/chain-support.d.ts +80 -0
- package/lib/core/helpers/chain-support.js +115 -0
- package/lib/core/helpers/core.d.ts +68 -0
- package/lib/core/helpers/core.js +285 -0
- package/lib/core/helpers/explorer-link.d.ts +16 -0
- package/lib/core/helpers/explorer-link.js +26 -0
- package/lib/core/helpers/multicall.d.ts +68 -0
- package/lib/core/helpers/multicall.js +103 -0
- package/lib/core/helpers/revert-decode.d.ts +248 -0
- package/lib/core/helpers/revert-decode.js +515 -0
- package/lib/core/helpers/signer.d.ts +52 -0
- package/lib/core/helpers/signer.js +145 -0
- package/lib/core/helpers/swap-router.d.ts +211 -0
- package/lib/core/helpers/swap-router.js +480 -0
- package/lib/core/helpers/vault-version.d.ts +23 -0
- package/lib/core/helpers/vault-version.js +75 -0
- package/lib/core/helpers/vaults.d.ts +89 -0
- package/lib/core/helpers/vaults.js +235 -0
- package/lib/core/helpers/web3.d.ts +353 -0
- package/lib/core/helpers/web3.js +992 -0
- package/lib/core/index.d.ts +23 -0
- package/lib/core/index.js +40 -0
- package/lib/core/logger/index.d.ts +98 -0
- package/lib/core/logger/index.js +144 -0
- package/lib/core/logger/slack.d.ts +16 -0
- package/lib/core/logger/slack.js +57 -0
- package/lib/core/vault-metadata.d.ts +12 -0
- package/lib/core/vault-metadata.js +42 -0
- package/lib/core/version-check.d.ts +58 -0
- package/lib/core/version-check.js +182 -0
- package/lib/evm/index.d.ts +2 -0
- package/lib/evm/index.js +19 -0
- package/lib/evm/methods/crossChainVault.d.ts +128 -0
- package/lib/evm/methods/crossChainVault.js +853 -0
- package/lib/evm/methods/crossChainVaultRegistry.d.ts +93 -0
- package/lib/evm/methods/crossChainVaultRegistry.js +240 -0
- package/lib/evm/methods/index.d.ts +2 -0
- package/lib/evm/methods/index.js +19 -0
- package/lib/evm/types/crossChain.d.ts +363 -0
- package/lib/evm/types/crossChain.js +20 -0
- package/lib/evm/types/index.d.ts +1 -0
- package/lib/evm/types/index.js +18 -0
- package/lib/index.d.ts +30 -0
- package/lib/index.js +52 -0
- package/lib/main.d.ts +527 -0
- package/lib/main.js +601 -0
- package/lib/modules/api/fetcher.d.ts +82 -0
- package/lib/modules/api/fetcher.js +150 -0
- package/lib/modules/api/index.d.ts +1 -0
- package/lib/modules/api/index.js +6 -0
- package/lib/modules/api/main.d.ts +313 -0
- package/lib/modules/api/main.js +479 -0
- package/lib/modules/sub-accounts/fetcher.d.ts +53 -0
- package/lib/modules/sub-accounts/fetcher.js +120 -0
- package/lib/modules/sub-accounts/index.d.ts +2 -0
- package/lib/modules/sub-accounts/index.js +19 -0
- package/lib/modules/sub-accounts/main.d.ts +243 -0
- package/lib/modules/sub-accounts/main.js +205 -0
- package/lib/modules/sub-accounts/utils.d.ts +106 -0
- package/lib/modules/sub-accounts/utils.js +112 -0
- package/lib/modules/vaults/adapter.helpers.d.ts +64 -0
- package/lib/modules/vaults/adapter.helpers.js +184 -0
- package/lib/modules/vaults/fetcher.d.ts +147 -0
- package/lib/modules/vaults/fetcher.js +368 -0
- package/lib/modules/vaults/getters.d.ts +570 -0
- package/lib/modules/vaults/getters.js +3051 -0
- package/lib/modules/vaults/index.d.ts +20 -0
- package/lib/modules/vaults/index.js +44 -0
- package/lib/modules/vaults/main.d.ts +601 -0
- package/lib/modules/vaults/main.js +1623 -0
- package/lib/modules/vaults/prefetch.d.ts +65 -0
- package/lib/modules/vaults/prefetch.js +120 -0
- package/lib/modules/vaults/read.actions.d.ts +225 -0
- package/lib/modules/vaults/read.actions.js +596 -0
- package/lib/modules/vaults/types.d.ts +71 -0
- package/lib/modules/vaults/types.js +3 -0
- package/lib/modules/vaults/utils/call-data-decoder.d.ts +61 -0
- package/lib/modules/vaults/utils/call-data-decoder.js +194 -0
- package/lib/modules/vaults/utils/date-utils.d.ts +50 -0
- package/lib/modules/vaults/utils/date-utils.js +84 -0
- package/lib/modules/vaults/utils.d.ts +140 -0
- package/lib/modules/vaults/utils.js +799 -0
- package/lib/modules/vaults/write.actions.d.ts +529 -0
- package/lib/modules/vaults/write.actions.js +1749 -0
- package/lib/polyfills.d.ts +1 -0
- package/lib/polyfills.js +12 -0
- package/lib/sdk.d.ts +26721 -0
- package/lib/services/coingecko/fetcher.d.ts +15 -0
- package/lib/services/coingecko/fetcher.js +67 -0
- package/lib/services/coingecko/index.d.ts +2 -0
- package/lib/services/coingecko/index.js +19 -0
- package/lib/services/coingecko/utils.d.ts +1 -0
- package/lib/services/coingecko/utils.js +24 -0
- package/lib/services/debank/fetcher.d.ts +126 -0
- package/lib/services/debank/fetcher.js +47 -0
- package/lib/services/debank/index.d.ts +2 -0
- package/lib/services/debank/index.js +19 -0
- package/lib/services/debank/utils.d.ts +38 -0
- package/lib/services/debank/utils.js +297 -0
- package/lib/services/layerzero/deposits.d.ts +49 -0
- package/lib/services/layerzero/deposits.js +166 -0
- package/lib/services/layerzero/redeems.d.ts +20 -0
- package/lib/services/layerzero/redeems.js +92 -0
- package/lib/services/layerzero/utils.d.ts +9 -0
- package/lib/services/layerzero/utils.js +22 -0
- package/lib/services/octavfi/fetcher.d.ts +9 -0
- package/lib/services/octavfi/fetcher.js +103 -0
- package/lib/services/octavfi/index.d.ts +3 -0
- package/lib/services/octavfi/index.js +20 -0
- package/lib/services/octavfi/types.d.ts +34 -0
- package/lib/services/octavfi/types.js +3 -0
- package/lib/services/octavfi/utils.d.ts +16 -0
- package/lib/services/octavfi/utils.js +212 -0
- package/lib/services/subgraph/fetcher.d.ts +2 -0
- package/lib/services/subgraph/fetcher.js +61 -0
- package/lib/services/subgraph/index.d.ts +2 -0
- package/lib/services/subgraph/index.js +19 -0
- package/lib/services/subgraph/schema.d.ts +45 -0
- package/lib/services/subgraph/schema.js +75 -0
- package/lib/services/subgraph/vaults.d.ts +25 -0
- package/lib/services/subgraph/vaults.js +1106 -0
- package/lib/services/swap-quotes/index.d.ts +105 -0
- package/lib/services/swap-quotes/index.js +77 -0
- package/lib/services/swap-quotes/paraswap.d.ts +51 -0
- package/lib/services/swap-quotes/paraswap.js +138 -0
- package/lib/types/api.d.ts +280 -0
- package/lib/types/api.js +3 -0
- package/lib/types/index.d.ts +12 -0
- package/lib/types/index.js +28 -0
- package/lib/types/points.d.ts +28 -0
- package/lib/types/points.js +3 -0
- package/lib/types/pools.d.ts +144 -0
- package/lib/types/pools.js +3 -0
- package/lib/types/staking.d.ts +28 -0
- package/lib/types/staking.js +3 -0
- package/lib/types/sub-accounts.d.ts +140 -0
- package/lib/types/sub-accounts.js +3 -0
- package/lib/types/subgraph.d.ts +74 -0
- package/lib/types/subgraph.js +3 -0
- package/lib/types/typed-contract.d.ts +102 -0
- package/lib/types/typed-contract.js +3 -0
- package/lib/types/user.d.ts +1 -0
- package/lib/types/user.js +3 -0
- package/lib/types/vaults.d.ts +714 -0
- package/lib/types/vaults.js +24 -0
- package/lib/types/web3.d.ts +51 -0
- package/lib/types/web3.js +14 -0
- package/lib/types/webserver.d.ts +698 -0
- package/lib/types/webserver.js +3 -0
- package/package.json +78 -0
|
@@ -0,0 +1,434 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
const write_actions_1 = require("../../modules/vaults/write.actions");
|
|
18
|
+
const swap_router_1 = require("../../core/helpers/swap-router");
|
|
19
|
+
const read_actions_1 = require("../../modules/vaults/read.actions");
|
|
20
|
+
const signer_1 = require("../../core/helpers/signer");
|
|
21
|
+
__exportStar(require("./getters"), exports);
|
|
22
|
+
/**
|
|
23
|
+
* EVM Adapter for August SDK
|
|
24
|
+
* Supports both ethers Signer/Wallet and wagmi/viem WalletClient
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* To access the EVM adapter instance
|
|
28
|
+
* ```
|
|
29
|
+
* const sdk = new AugustSDK()
|
|
30
|
+
* sdk.evm.vaultRedeem()
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
class EVMAdapter {
|
|
34
|
+
signer;
|
|
35
|
+
rawSigner;
|
|
36
|
+
constructor(signer) {
|
|
37
|
+
this.rawSigner = signer;
|
|
38
|
+
// Don't normalize in constructor - do it lazily when needed
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Set a new signer (supports both ethers and viem/wagmi)
|
|
42
|
+
* @param signer - Either an ethers Signer/Wallet or viem WalletClient
|
|
43
|
+
*/
|
|
44
|
+
setSigner(signer) {
|
|
45
|
+
this.rawSigner = signer;
|
|
46
|
+
this.signer = undefined; // Reset normalized signer
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Get the normalized ethers-compatible signer
|
|
50
|
+
* Converts viem WalletClient to ethers Signer if needed
|
|
51
|
+
*/
|
|
52
|
+
async getSigner() {
|
|
53
|
+
if (!this.rawSigner) {
|
|
54
|
+
throw new Error('No signer provided');
|
|
55
|
+
}
|
|
56
|
+
// If we already have a normalized signer, return it
|
|
57
|
+
if (this.signer) {
|
|
58
|
+
return this.signer;
|
|
59
|
+
}
|
|
60
|
+
// Normalize and cache the signer. The attribution wrap is unconditional
|
|
61
|
+
// and reads the process-global config at send time, so a cached signer
|
|
62
|
+
// honors attribution enabled or reset after caching.
|
|
63
|
+
this.signer = (0, signer_1.wrapSignerWithAttribution)(await (0, signer_1.normalizeSigner)(this.rawSigner));
|
|
64
|
+
return this.signer;
|
|
65
|
+
}
|
|
66
|
+
// Core EVM operations
|
|
67
|
+
async vaultApprove(options) {
|
|
68
|
+
const signer = await this.getSigner();
|
|
69
|
+
return (0, write_actions_1.vaultApprove)(signer, options);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Approve a vault to spend a deposit token, returning a discriminated
|
|
73
|
+
* {@link ApproveResult} so callers can tell `sent` from `sufficient`
|
|
74
|
+
* (existing allowance covers) and `native` (no allowance applies).
|
|
75
|
+
* Prefer this over {@link vaultApprove} for new integrations.
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```ts
|
|
79
|
+
* const r = await augustSdk.evm.approve({
|
|
80
|
+
* target: vaultAddress,
|
|
81
|
+
* wallet: walletAddress,
|
|
82
|
+
* amount: '100',
|
|
83
|
+
* wait: true,
|
|
84
|
+
* });
|
|
85
|
+
* if (r.kind === 'sent') console.log('approve tx', r.hash);
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
async approve(options) {
|
|
89
|
+
const signer = await this.getSigner();
|
|
90
|
+
return (0, write_actions_1.approve)(signer, options);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Read the ERC-20 allowance the wallet has granted the vault to spend its
|
|
94
|
+
* underlying asset, returned as a normalized number. For the newer typed
|
|
95
|
+
* read that returns a raw `bigint` and accepts an explicit `asset` override,
|
|
96
|
+
* use {@link EVMAdapter.allowance}.
|
|
97
|
+
*
|
|
98
|
+
* Only `target` (vault address) and `wallet` are read from `options`; the
|
|
99
|
+
* remaining {@link IContractWriteOptions} fields are ignored.
|
|
100
|
+
*
|
|
101
|
+
* @param options - `{ target, wallet }` (other fields ignored).
|
|
102
|
+
* @returns Normalized allowance (`{ raw, normalized }`), or `undefined` when
|
|
103
|
+
* `target` / `wallet` fail address validation.
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```ts
|
|
107
|
+
* const a = await augustSdk.evm.vaultAllowance({
|
|
108
|
+
* target: vaultAddress,
|
|
109
|
+
* wallet: walletAddress,
|
|
110
|
+
* });
|
|
111
|
+
* console.log(a?.normalized);
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
async vaultAllowance(options) {
|
|
115
|
+
const signer = await this.getSigner();
|
|
116
|
+
return (0, read_actions_1.vaultAllowance)(signer, options);
|
|
117
|
+
}
|
|
118
|
+
// Vault operations (delegate to modules)
|
|
119
|
+
/**
|
|
120
|
+
* Deposit into an August vault. Routes automatically: V1 single-asset vaults
|
|
121
|
+
* deposit the underlying directly; V2 multi-asset vaults route through the
|
|
122
|
+
* adapter for non-underlying `depositAsset`. If allowance is insufficient
|
|
123
|
+
* the method submits an approve transaction first (the approve step always
|
|
124
|
+
* waits for confirmation to close a race window, regardless of `wait`).
|
|
125
|
+
*
|
|
126
|
+
* @param options - {@link IContractWriteOptions}. `target` and `wallet` are
|
|
127
|
+
* required; pass `amount`, `depositAsset` (defaults to the vault's
|
|
128
|
+
* underlying), `chainId`, `poolName`, `wait`, and `isDepositWithPermit`
|
|
129
|
+
* as needed.
|
|
130
|
+
* @returns The deposit `TransactionResponse`, or `undefined` if an
|
|
131
|
+
* approval-only path was taken and no deposit transaction was sent.
|
|
132
|
+
* @throws AugustValidationError on invalid inputs (bad address, bad amount).
|
|
133
|
+
* @throws AugustSDKError on RPC / contract revert during the deposit.
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```ts
|
|
137
|
+
* const tx = await augustSdk.evm.vaultDeposit({
|
|
138
|
+
* target: vaultAddress,
|
|
139
|
+
* wallet: walletAddress,
|
|
140
|
+
* amount: '100',
|
|
141
|
+
* wait: true,
|
|
142
|
+
* });
|
|
143
|
+
* ```
|
|
144
|
+
*/
|
|
145
|
+
async vaultDeposit(options) {
|
|
146
|
+
const signer = await this.getSigner();
|
|
147
|
+
return (0, write_actions_1.vaultDeposit)(signer, options);
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Submit a redemption request against a vault. Shares are escrowed and the
|
|
151
|
+
* underlying assets are released asynchronously by the protocol; callers
|
|
152
|
+
* collect the matured assets via {@link EVMAdapter.vaultRedeem}, or use the
|
|
153
|
+
* instant-redeem variant by setting `isInstantRedeem: true`.
|
|
154
|
+
*
|
|
155
|
+
* @param options - {@link IContractWriteOptions}. `target`, `wallet`, and
|
|
156
|
+
* `amount` (in shares) are required. Set `isInstantRedeem: true` to take
|
|
157
|
+
* the instant-redeem path when the vault supports it.
|
|
158
|
+
* @returns The request `TransactionResponse`, or `undefined` if the request
|
|
159
|
+
* could not be built (validation failure).
|
|
160
|
+
* @throws AugustValidationError on invalid inputs.
|
|
161
|
+
* @throws AugustSDKError on RPC / contract revert.
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* ```ts
|
|
165
|
+
* const tx = await augustSdk.evm.vaultRequestRedeem({
|
|
166
|
+
* target: vaultAddress,
|
|
167
|
+
* wallet: walletAddress,
|
|
168
|
+
* amount: shareAmount,
|
|
169
|
+
* wait: true,
|
|
170
|
+
* });
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
173
|
+
async vaultRequestRedeem(options) {
|
|
174
|
+
const signer = await this.getSigner();
|
|
175
|
+
return (0, write_actions_1.vaultRequestRedeem)(signer, options);
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Deposit the chain's native asset (ETH / AVAX / etc.) into a vault by
|
|
179
|
+
* routing through the `MultiAssetNativeDepositWrapper`. The wrapper handles
|
|
180
|
+
* native-to-wrapped conversion and the subsequent vault deposit in a single
|
|
181
|
+
* transaction.
|
|
182
|
+
*
|
|
183
|
+
* @param options - {@link INativeDepositOptions}: `wrapperAddress`, `amount`
|
|
184
|
+
* (native, scaled by the chain's native decimals), optional `receiver`
|
|
185
|
+
* (defaults to the signer), and optional `wait`.
|
|
186
|
+
* @returns The deposit `TransactionResponse`.
|
|
187
|
+
* @throws AugustValidationError on invalid inputs.
|
|
188
|
+
* @throws AugustSDKError on RPC / contract revert.
|
|
189
|
+
*
|
|
190
|
+
* @example
|
|
191
|
+
* ```ts
|
|
192
|
+
* const tx = await augustSdk.evm.depositNative({
|
|
193
|
+
* wrapperAddress: nativeWrapperAddress,
|
|
194
|
+
* amount: parseEther('1'),
|
|
195
|
+
* wait: true,
|
|
196
|
+
* });
|
|
197
|
+
* ```
|
|
198
|
+
*/
|
|
199
|
+
async depositNative(options) {
|
|
200
|
+
const signer = await this.getSigner();
|
|
201
|
+
return (0, write_actions_1.depositNative)(signer, options);
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Swap one or more whitelisted ERC-20s into a vault's reference asset via
|
|
205
|
+
* the on-chain `SwapRouter` and deposit the proceeds. The router handles
|
|
206
|
+
* fee accrual, slippage protection, and the v1/v3 vs v2 deposit-interface
|
|
207
|
+
* branching. Approval is sent automatically for each `swaps[i].tokenIn`
|
|
208
|
+
* when the caller's allowance against the SwapRouter is below `amountIn`.
|
|
209
|
+
*
|
|
210
|
+
* @param options - {@link ISwapAndDepositOptions}.
|
|
211
|
+
* @returns The transaction hash of the `swapAndDeposit` call.
|
|
212
|
+
* @throws AugustValidationError on invalid inputs (bad chain, empty swaps).
|
|
213
|
+
* @throws AugustSDKError on RPC / contract revert.
|
|
214
|
+
*
|
|
215
|
+
* @example
|
|
216
|
+
* ```ts
|
|
217
|
+
* const quote = await fetchSwapQuote({
|
|
218
|
+
* chainId: 1, srcToken: WBTC, srcDecimals: 8,
|
|
219
|
+
* destToken: USDC, destDecimals: 6, amount: 100_000_000n,
|
|
220
|
+
* receiver: SWAP_ROUTER_ADDRESSES[1]!,
|
|
221
|
+
* });
|
|
222
|
+
* const hash = await augustSdk.evm.swapAndDeposit({
|
|
223
|
+
* chainId: 1, vault, receiver: wallet,
|
|
224
|
+
* swaps: [{ tokenIn: WBTC, tokenOut: USDC, amountIn: 100_000_000n,
|
|
225
|
+
* minAmountOut: quote.minAmountOut, router: quote.router, payload: quote.payload }],
|
|
226
|
+
* });
|
|
227
|
+
* ```
|
|
228
|
+
*/
|
|
229
|
+
async swapAndDeposit(options) {
|
|
230
|
+
const signer = await this.getSigner();
|
|
231
|
+
return (0, write_actions_1.swapAndDeposit)(signer, options);
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Deposit a vault's reference asset through the SwapRouter — no swap.
|
|
235
|
+
* Use this when the caller already holds the reference asset but wants
|
|
236
|
+
* the origin/referral fee accounting that the SwapRouter path provides.
|
|
237
|
+
*
|
|
238
|
+
* @param options - {@link ISwapRouterDirectDepositOptions}.
|
|
239
|
+
* @returns The transaction hash of the `deposit` call.
|
|
240
|
+
*/
|
|
241
|
+
async depositViaSwapRouter(options) {
|
|
242
|
+
const signer = await this.getSigner();
|
|
243
|
+
return (0, write_actions_1.depositViaSwapRouter)(signer, options);
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Deposit native ETH (or chain-native equivalent) into a vault via the
|
|
247
|
+
* SwapRouter. Only valid when the vault's reference asset is the chain's
|
|
248
|
+
* wrapped-native token — the SwapRouter wraps `amount` and deposits.
|
|
249
|
+
*
|
|
250
|
+
* @param options - {@link ISwapRouterNativeDepositOptions}.
|
|
251
|
+
* @returns The transaction hash of the `depositNativeToken` call.
|
|
252
|
+
*/
|
|
253
|
+
async depositNativeViaSwapRouter(options) {
|
|
254
|
+
const signer = await this.getSigner();
|
|
255
|
+
return (0, write_actions_1.depositNativeViaSwapRouter)(signer, options);
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Deposit into a vault through the on-chain `SwapRouter`, choosing the router
|
|
259
|
+
* path from `depositAsset` (direct deposit, native wrap, or a swap to the
|
|
260
|
+
* reference asset). The high-level, explicit counterpart to the SwapRouter
|
|
261
|
+
* branch inside {@link vaultDeposit} — the caller opts into the router
|
|
262
|
+
* deliberately, so a native-deposit vault is never accidentally swapped.
|
|
263
|
+
*
|
|
264
|
+
* Reads the vault's reference asset + decimals on-chain, resolves the swap
|
|
265
|
+
* quote and fail-closes on aggregator/whitelist drift, and sends the ERC-20
|
|
266
|
+
* approval to the SwapRouter when allowance is short.
|
|
267
|
+
*
|
|
268
|
+
* @param options - {@link ISwapRouterDepositOptions}.
|
|
269
|
+
* @returns The transaction hash of the router deposit call.
|
|
270
|
+
* @throws AugustValidationError on unsupported chain, invalid address, zero
|
|
271
|
+
* amount, a native deposit into a non-wrapped-native vault, or quote drift.
|
|
272
|
+
* @example
|
|
273
|
+
* ```ts
|
|
274
|
+
* const hash = await augustSdk.evm.swapRouterDeposit({
|
|
275
|
+
* chainId: 1, vault, depositAsset: USDT, amount: '100', slippageBps: 50,
|
|
276
|
+
* });
|
|
277
|
+
* ```
|
|
278
|
+
*/
|
|
279
|
+
async swapRouterDeposit(options) {
|
|
280
|
+
const signer = await this.getSigner();
|
|
281
|
+
return (0, write_actions_1.swapRouterDeposit)(signer, options);
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Resolves the real, post-execution outcome of a SwapRouter deposit from
|
|
285
|
+
* its mined receipt — the actual amount that reached the vault (and shares
|
|
286
|
+
* minted), decoded from the vault's own `Deposit` event, rather than the
|
|
287
|
+
* pre-trade quote shown before submission.
|
|
288
|
+
*
|
|
289
|
+
* @param options - {@link ISwapRouterDepositResultOptions}.
|
|
290
|
+
* @returns The decoded {@link ISwapRouterDepositResult}, or `null` if the
|
|
291
|
+
* receipt isn't found yet or carries no matching `Deposit` log.
|
|
292
|
+
* @example
|
|
293
|
+
* ```ts
|
|
294
|
+
* const hash = await augustSdk.evm.swapRouterDeposit({ ... });
|
|
295
|
+
* const result = await augustSdk.evm.getSwapRouterDepositResult({ txHash: hash, vault });
|
|
296
|
+
* ```
|
|
297
|
+
*/
|
|
298
|
+
async getSwapRouterDepositResult(options) {
|
|
299
|
+
const signer = await this.getSigner();
|
|
300
|
+
return (0, swap_router_1.getSwapRouterDepositResult)(signer, options);
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Claim assets from a matured redemption request on a dated-redemption
|
|
304
|
+
* (RWA-style) vault. The `year`, `month`, `day`, and `receiverIndex` tuple
|
|
305
|
+
* identifies which batch of the user's matured requests to redeem from —
|
|
306
|
+
* these are emitted at request-time and indexed by the subgraph.
|
|
307
|
+
*
|
|
308
|
+
* For non-dated vaults that complete their redemption via `instantRedeem`,
|
|
309
|
+
* see {@link EVMAdapter.vaultRequestRedeem} with `isInstantRedeem: true`.
|
|
310
|
+
*
|
|
311
|
+
* @param options - {@link IContractWriteOptions} plus `year` / `month` /
|
|
312
|
+
* `day` / `receiverIndex` identifying the matured batch to claim.
|
|
313
|
+
* @returns The redeem `TransactionResponse`.
|
|
314
|
+
* @throws AugustValidationError on invalid inputs.
|
|
315
|
+
* @throws AugustSDKError on RPC / contract revert.
|
|
316
|
+
*
|
|
317
|
+
* @example
|
|
318
|
+
* ```ts
|
|
319
|
+
* const tx = await augustSdk.evm.vaultRedeem({
|
|
320
|
+
* target: vaultAddress,
|
|
321
|
+
* wallet: walletAddress,
|
|
322
|
+
* amount: shareAmount,
|
|
323
|
+
* year: '2026',
|
|
324
|
+
* month: '06',
|
|
325
|
+
* day: '02',
|
|
326
|
+
* receiverIndex: '0',
|
|
327
|
+
* wait: true,
|
|
328
|
+
* });
|
|
329
|
+
* ```
|
|
330
|
+
*/
|
|
331
|
+
async vaultRedeem(options) {
|
|
332
|
+
const signer = await this.getSigner();
|
|
333
|
+
return (0, write_actions_1.vaultRedeem)(signer, options);
|
|
334
|
+
}
|
|
335
|
+
async sendersWhitelistAddress(options) {
|
|
336
|
+
const signer = await this.getSigner();
|
|
337
|
+
return (0, read_actions_1.sendersWhitelistAddress)(signer, options);
|
|
338
|
+
}
|
|
339
|
+
async isWhitelisted(options) {
|
|
340
|
+
const signer = await this.getSigner();
|
|
341
|
+
return (0, read_actions_1.isWhitelisted)(signer, options);
|
|
342
|
+
}
|
|
343
|
+
async getDeposited(options) {
|
|
344
|
+
const signer = await this.getSigner();
|
|
345
|
+
return (0, read_actions_1.getDeposited)(signer, options);
|
|
346
|
+
}
|
|
347
|
+
async getRemainingAllocations(options) {
|
|
348
|
+
const signer = await this.getSigner();
|
|
349
|
+
return (0, read_actions_1.getRemainingAllocations)(signer, options);
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Preview the share output of a deposit without broadcasting a transaction.
|
|
353
|
+
* See {@link readPreviewDeposit} for the routing details (EVM-1 vs EVM-2
|
|
354
|
+
* multi-asset vaults).
|
|
355
|
+
*
|
|
356
|
+
* @returns Shares minted in raw on-chain units (share-token decimals).
|
|
357
|
+
*
|
|
358
|
+
* @example
|
|
359
|
+
* ```ts
|
|
360
|
+
* const shares = await augustSdk.evm.previewDeposit({
|
|
361
|
+
* vault: '0x...',
|
|
362
|
+
* amount: 1_000_000n,
|
|
363
|
+
* });
|
|
364
|
+
* ```
|
|
365
|
+
*/
|
|
366
|
+
async previewDeposit(options) {
|
|
367
|
+
const signer = await this.getSigner();
|
|
368
|
+
return (0, read_actions_1.previewDeposit)(signer, options);
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Preview the assets returned by redeeming a number of shares, without
|
|
372
|
+
* broadcasting a transaction.
|
|
373
|
+
*
|
|
374
|
+
* @returns Assets returned in raw on-chain units (asset decimals).
|
|
375
|
+
*
|
|
376
|
+
* @example
|
|
377
|
+
* ```ts
|
|
378
|
+
* const assets = await augustSdk.evm.previewRedeem({
|
|
379
|
+
* vault: '0x...',
|
|
380
|
+
* shares: 1_000_000_000_000_000_000n,
|
|
381
|
+
* });
|
|
382
|
+
* ```
|
|
383
|
+
*/
|
|
384
|
+
async previewRedeem(options) {
|
|
385
|
+
const signer = await this.getSigner();
|
|
386
|
+
return (0, read_actions_1.previewRedeem)(signer, options);
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Read the ERC-20 allowance an owner has granted the vault. Defaults to the
|
|
390
|
+
* vault's underlying asset; pass `asset` to override.
|
|
391
|
+
*
|
|
392
|
+
* @returns Allowance as a raw `bigint`.
|
|
393
|
+
*
|
|
394
|
+
* @example
|
|
395
|
+
* ```ts
|
|
396
|
+
* const raw = await augustSdk.evm.allowance({ vault, owner });
|
|
397
|
+
* ```
|
|
398
|
+
*/
|
|
399
|
+
async allowance(options) {
|
|
400
|
+
const signer = await this.getSigner();
|
|
401
|
+
return (0, read_actions_1.allowance)(signer, options);
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Read an ERC-20 token balance.
|
|
405
|
+
*
|
|
406
|
+
* @returns Balance as a raw `bigint`.
|
|
407
|
+
*
|
|
408
|
+
* @example
|
|
409
|
+
* ```ts
|
|
410
|
+
* const raw = await augustSdk.evm.balanceOf({ asset: usdcAddress, owner });
|
|
411
|
+
* ```
|
|
412
|
+
*/
|
|
413
|
+
async balanceOf(options) {
|
|
414
|
+
const signer = await this.getSigner();
|
|
415
|
+
return (0, read_actions_1.balanceOf)(signer, options);
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Read the maximum deposit accepted by the vault for the supplied
|
|
419
|
+
* receiver. Useful for "vault is full" gates.
|
|
420
|
+
*
|
|
421
|
+
* @returns Max deposit as a raw `bigint`.
|
|
422
|
+
*
|
|
423
|
+
* @example
|
|
424
|
+
* ```ts
|
|
425
|
+
* const cap = await augustSdk.evm.maxDeposit({ vault });
|
|
426
|
+
* ```
|
|
427
|
+
*/
|
|
428
|
+
async maxDeposit(options) {
|
|
429
|
+
const signer = await this.getSigner();
|
|
430
|
+
return (0, read_actions_1.maxDeposit)(signer, options);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
exports.default = EVMAdapter;
|
|
434
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @todo
|
|
3
|
+
*/
|
|
4
|
+
export declare const functionsToCallMapping: (provider: any, contract: any, functionCalls: any[]) => any[];
|
|
5
|
+
/**
|
|
6
|
+
* @todo
|
|
7
|
+
*/
|
|
8
|
+
export declare const functionsToCallReduction: (acc: any, curr: any, i: number, functionCalls: any[], contractCalls: any[]) => any;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.functionsToCallReduction = exports.functionsToCallMapping = void 0;
|
|
4
|
+
const core_1 = require("../../core");
|
|
5
|
+
/**
|
|
6
|
+
* @todo
|
|
7
|
+
*/
|
|
8
|
+
const functionsToCallMapping = (provider, contract, functionCalls) => {
|
|
9
|
+
return functionCalls.map((f) => {
|
|
10
|
+
if (f === 'symbol') {
|
|
11
|
+
return (0, core_1.getSymbol)(provider, contract);
|
|
12
|
+
}
|
|
13
|
+
if (f === 'decimals') {
|
|
14
|
+
return (0, core_1.getDecimals)(provider, contract);
|
|
15
|
+
}
|
|
16
|
+
return contract[f]();
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
exports.functionsToCallMapping = functionsToCallMapping;
|
|
20
|
+
/**
|
|
21
|
+
* @todo
|
|
22
|
+
*/
|
|
23
|
+
const functionsToCallReduction = (acc, curr, i, functionCalls, contractCalls) => {
|
|
24
|
+
let val;
|
|
25
|
+
if (functionCalls[i] === 'totalSupply' ||
|
|
26
|
+
functionCalls[i] === 'totalAssets' ||
|
|
27
|
+
functionCalls[i] === 'globalLoansAmount' ||
|
|
28
|
+
functionCalls[i] === 'maxSupply' ||
|
|
29
|
+
functionCalls[i] === 'depositCap') {
|
|
30
|
+
val = (0, core_1.toNormalizedBn)(curr, contractCalls[0]);
|
|
31
|
+
}
|
|
32
|
+
else if (functionCalls[i] === 'getTotalLoansDeployed') {
|
|
33
|
+
val = (0, core_1.toNormalizedBn)(curr, 0);
|
|
34
|
+
}
|
|
35
|
+
else if (functionCalls[i] === 'withdrawalFee') {
|
|
36
|
+
val = (0, core_1.toNormalizedBn)(curr, 2);
|
|
37
|
+
}
|
|
38
|
+
else if (functionCalls[i] === 'decimals') {
|
|
39
|
+
val = Number(curr.toString());
|
|
40
|
+
}
|
|
41
|
+
else if (functionCalls[i] === 'loansOperator') {
|
|
42
|
+
// TODO: hardcoded as we cannot pull the real strategist
|
|
43
|
+
val = '0x4DCb388488622e47683EAd1a147947140a31e485';
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
val = curr;
|
|
47
|
+
}
|
|
48
|
+
return { ...acc, [functionCalls[i]]: val };
|
|
49
|
+
};
|
|
50
|
+
exports.functionsToCallReduction = functionsToCallReduction;
|
|
51
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ISolanaNetwork } from '../../types';
|
|
2
|
+
import { vaultIdl } from './idl/vault-idl';
|
|
3
|
+
declare const fallbackDecimals = 8;
|
|
4
|
+
declare const fallbackNetwork: ISolanaNetwork;
|
|
5
|
+
declare const fallbackRpcEndpoints: {
|
|
6
|
+
readonly devnet: "https://api.devnet.solana.com";
|
|
7
|
+
readonly mainnet: "https://api.mainnet-beta.solana.com";
|
|
8
|
+
readonly testnet: "https://api.testnet.solana.com";
|
|
9
|
+
readonly localnet: "http://127.0.0.1:8899";
|
|
10
|
+
};
|
|
11
|
+
declare const programIds: {
|
|
12
|
+
devnet: {
|
|
13
|
+
vault: string;
|
|
14
|
+
};
|
|
15
|
+
"mainnet-beta": {
|
|
16
|
+
vault: string;
|
|
17
|
+
};
|
|
18
|
+
localnet: {
|
|
19
|
+
vault: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
/** Solana networks the canonical august_vault program is actually deployed on. */
|
|
23
|
+
type ISolanaDeployedNetwork = keyof typeof programIds;
|
|
24
|
+
/**
|
|
25
|
+
* Program ids for `network`, or `undefined` when the canonical program has no
|
|
26
|
+
* deployment there (currently `testnet`). Callers must handle `undefined` —
|
|
27
|
+
* silently substituting a default would hand back a dead address.
|
|
28
|
+
*/
|
|
29
|
+
declare function getDeployedProgramIds(network: ISolanaNetwork): {
|
|
30
|
+
vault: string;
|
|
31
|
+
} | undefined;
|
|
32
|
+
export { fallbackDecimals, fallbackNetwork, fallbackRpcEndpoints, getDeployedProgramIds, programIds, vaultIdl, };
|
|
33
|
+
export type { ISolanaDeployedNetwork };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.vaultIdl = exports.programIds = exports.fallbackRpcEndpoints = exports.fallbackNetwork = exports.fallbackDecimals = void 0;
|
|
4
|
+
exports.getDeployedProgramIds = getDeployedProgramIds;
|
|
5
|
+
const vault_idl_1 = require("./idl/vault-idl");
|
|
6
|
+
Object.defineProperty(exports, "vaultIdl", { enumerable: true, get: function () { return vault_idl_1.vaultIdl; } });
|
|
7
|
+
const fallbackDecimals = 8;
|
|
8
|
+
exports.fallbackDecimals = fallbackDecimals;
|
|
9
|
+
const fallbackNetwork = 'mainnet-beta';
|
|
10
|
+
exports.fallbackNetwork = fallbackNetwork;
|
|
11
|
+
// ============================================================================
|
|
12
|
+
// SOLANA CONFIGURATION
|
|
13
|
+
// ============================================================================
|
|
14
|
+
const fallbackRpcEndpoints = {
|
|
15
|
+
devnet: 'https://api.devnet.solana.com',
|
|
16
|
+
mainnet: 'https://api.mainnet-beta.solana.com',
|
|
17
|
+
testnet: 'https://api.testnet.solana.com',
|
|
18
|
+
localnet: 'http://127.0.0.1:8899',
|
|
19
|
+
};
|
|
20
|
+
exports.fallbackRpcEndpoints = fallbackRpcEndpoints;
|
|
21
|
+
// The shared, canonical august_vault program (multi-vault), deployed under the
|
|
22
|
+
// same id (`up12…`) on devnet and mainnet-beta. Per-vault program deploys (e.g.
|
|
23
|
+
// the legacy SyrupBTC `7B8n…`, and the interim devnet `C8B1…`) are retired. At
|
|
24
|
+
// runtime the program id is resolved from backend vault metadata; this map is
|
|
25
|
+
// the default/fallback.
|
|
26
|
+
//
|
|
27
|
+
// Deliberately partial: no `testnet` entry — the program isn't deployed there,
|
|
28
|
+
// and mapping it would hand callers a dead address that only fails deep inside a
|
|
29
|
+
// transaction. Unmapped networks throw from `getProgram`/`getProgramId` instead.
|
|
30
|
+
// `satisfies` keeps the literal ids in the generated docs while checking keys
|
|
31
|
+
// against ISolanaNetwork, so `testnet` is absent from the type, not optional.
|
|
32
|
+
const programIds = {
|
|
33
|
+
devnet: {
|
|
34
|
+
vault: 'up12bytoZBmwofqsySf2uqKQ7zpfeKiAWwfvqzJjtRt',
|
|
35
|
+
},
|
|
36
|
+
['mainnet-beta']: {
|
|
37
|
+
vault: 'up12bytoZBmwofqsySf2uqKQ7zpfeKiAWwfvqzJjtRt',
|
|
38
|
+
},
|
|
39
|
+
localnet: {
|
|
40
|
+
vault: 'up12bytoZBmwofqsySf2uqKQ7zpfeKiAWwfvqzJjtRt',
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
exports.programIds = programIds;
|
|
44
|
+
/**
|
|
45
|
+
* Program ids for `network`, or `undefined` when the canonical program has no
|
|
46
|
+
* deployment there (currently `testnet`). Callers must handle `undefined` —
|
|
47
|
+
* silently substituting a default would hand back a dead address.
|
|
48
|
+
*/
|
|
49
|
+
function getDeployedProgramIds(network) {
|
|
50
|
+
return programIds[network];
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ITokenizedVault } from '../../types';
|
|
2
|
+
import type { IVaultBaseOptions } from '../../modules/vaults/types';
|
|
3
|
+
/**
|
|
4
|
+
* Fetch Solana vault data from on-chain program state.
|
|
5
|
+
* Falls back to backend-only data when Solana RPC is unavailable,
|
|
6
|
+
* ensuring vaults always appear in the list even without on-chain access.
|
|
7
|
+
* @param tokenizedVault Vault metadata from backend
|
|
8
|
+
* @param options RPC configuration with Solana service
|
|
9
|
+
* @returns Formatted vault object with Solana-specific fields
|
|
10
|
+
*/
|
|
11
|
+
export declare const getSolanaVault: (tokenizedVault: ITokenizedVault, options: IVaultBaseOptions) => Promise<import("../../types").IVault>;
|