@ember-finance/sdk 2.0.0 → 2.0.2
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 +64 -60
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/src/abis/EmberETHVault.json +343 -2
- package/dist/src/abis/EmberProtocolConfig.json +61 -2
- package/dist/src/abis/EmberVault.json +343 -2
- package/dist/src/abis/EmberVaultMintBurnOFTAdapter.json +1382 -0
- package/dist/src/abis/index.d.ts +3 -1
- package/dist/src/abis/index.js +12 -22
- package/dist/src/api/api.d.ts +2 -2
- package/dist/src/api/api.js +2 -18
- package/dist/src/api/apis/accounts-api.d.ts +9 -9
- package/dist/src/api/apis/accounts-api.js +63 -73
- package/dist/src/api/apis/vaults-api.d.ts +20 -20
- package/dist/src/api/apis/vaults-api.js +130 -140
- package/dist/src/api/base.d.ts +1 -1
- package/dist/src/api/base.js +7 -15
- package/dist/src/api/common.d.ts +2 -2
- package/dist/src/api/common.js +13 -25
- package/dist/src/api/configuration.js +2 -6
- package/dist/src/api/index.d.ts +3 -3
- package/dist/src/api/index.js +3 -19
- package/dist/src/api/models/account-transaction-transaction-data.d.ts +5 -5
- package/dist/src/api/models/account-transaction-transaction-data.js +1 -2
- package/dist/src/api/models/account-transaction.d.ts +1 -1
- package/dist/src/api/models/account-transaction.js +1 -4
- package/dist/src/api/models/account-withdrawal-request.d.ts +2 -2
- package/dist/src/api/models/account-withdrawal-request.js +1 -4
- package/dist/src/api/models/apy-history-v2.d.ts +1 -1
- package/dist/src/api/models/apy-history-v2.js +1 -2
- package/dist/src/api/models/apy-history.js +1 -2
- package/dist/src/api/models/asset.js +1 -2
- package/dist/src/api/models/borrowed.d.ts +1 -1
- package/dist/src/api/models/borrowed.js +1 -2
- package/dist/src/api/models/chain.js +1 -4
- package/dist/src/api/models/coin-price.js +1 -2
- package/dist/src/api/models/deposit-transaction.d.ts +2 -2
- package/dist/src/api/models/deposit-transaction.js +1 -2
- package/dist/src/api/models/ember-position.d.ts +1 -1
- package/dist/src/api/models/ember-position.js +1 -2
- package/dist/src/api/models/exposure-coin.d.ts +1 -1
- package/dist/src/api/models/exposure-coin.js +1 -2
- package/dist/src/api/models/exposure-protocol.d.ts +6 -6
- package/dist/src/api/models/exposure-protocol.js +1 -2
- package/dist/src/api/models/exposure.d.ts +2 -2
- package/dist/src/api/models/exposure.js +1 -2
- package/dist/src/api/models/fee.d.ts +1 -1
- package/dist/src/api/models/fee.js +1 -2
- package/dist/src/api/models/fees.js +1 -2
- package/dist/src/api/models/history-interval.js +1 -4
- package/dist/src/api/models/index.d.ts +78 -78
- package/dist/src/api/models/index.js +78 -94
- package/dist/src/api/models/lp.d.ts +3 -3
- package/dist/src/api/models/lp.js +1 -2
- package/dist/src/api/models/manager.js +1 -2
- package/dist/src/api/models/min-withdrawal-shares-updated-event.js +1 -2
- package/dist/src/api/models/perps.d.ts +1 -1
- package/dist/src/api/models/perps.js +1 -2
- package/dist/src/api/models/pnl-history-interval.js +1 -4
- package/dist/src/api/models/pnl-history.js +1 -2
- package/dist/src/api/models/poc-report-asset.js +1 -2
- package/dist/src/api/models/poc-report-assets.d.ts +1 -1
- package/dist/src/api/models/poc-report-assets.js +1 -2
- package/dist/src/api/models/poc-report-exchange.d.ts +1 -1
- package/dist/src/api/models/poc-report-exchange.js +1 -2
- package/dist/src/api/models/poc-report-exchanges.d.ts +1 -1
- package/dist/src/api/models/poc-report-exchanges.js +1 -2
- package/dist/src/api/models/poc-report-protocol.js +1 -2
- package/dist/src/api/models/poc-report-token.js +1 -2
- package/dist/src/api/models/poc-report-wallet.d.ts +2 -2
- package/dist/src/api/models/poc-report-wallet.js +1 -2
- package/dist/src/api/models/poc-report-wallets.d.ts +1 -1
- package/dist/src/api/models/poc-report-wallets.js +1 -2
- package/dist/src/api/models/position-history-interval.js +1 -4
- package/dist/src/api/models/position-history.js +1 -4
- package/dist/src/api/models/position-value.js +1 -4
- package/dist/src/api/models/position.js +1 -2
- package/dist/src/api/models/process-requests-summary-event.js +1 -2
- package/dist/src/api/models/proof-of-capital-report.d.ts +3 -3
- package/dist/src/api/models/proof-of-capital-report.js +1 -2
- package/dist/src/api/models/protocol-fee-collected-event.js +1 -2
- package/dist/src/api/models/protocol-info.d.ts +3 -3
- package/dist/src/api/models/protocol-info.js +1 -2
- package/dist/src/api/models/protocol.js +1 -2
- package/dist/src/api/models/raw-event-event-data.d.ts +17 -17
- package/dist/src/api/models/raw-event-event-data.js +1 -2
- package/dist/src/api/models/raw-event.d.ts +1 -1
- package/dist/src/api/models/raw-event.js +1 -4
- package/dist/src/api/models/redeem-request-cancelled-transaction.d.ts +2 -2
- package/dist/src/api/models/redeem-request-cancelled-transaction.js +1 -2
- package/dist/src/api/models/redeem-request-processed-transaction.d.ts +2 -2
- package/dist/src/api/models/redeem-request-processed-transaction.js +1 -2
- package/dist/src/api/models/redeem-request-skipped-transaction.d.ts +2 -2
- package/dist/src/api/models/redeem-request-skipped-transaction.js +1 -2
- package/dist/src/api/models/redeem-request-transaction.d.ts +2 -2
- package/dist/src/api/models/redeem-request-transaction.js +1 -2
- package/dist/src/api/models/reported-apy.js +1 -2
- package/dist/src/api/models/request-processed-event.js +1 -2
- package/dist/src/api/models/request-redeemed-event.js +1 -2
- package/dist/src/api/models/reward-token.js +1 -2
- package/dist/src/api/models/reward.d.ts +1 -1
- package/dist/src/api/models/reward.js +1 -2
- package/dist/src/api/models/share-price-history.js +1 -2
- package/dist/src/api/models/strategy-account.d.ts +1 -1
- package/dist/src/api/models/strategy-account.js +1 -2
- package/dist/src/api/models/strategy.js +1 -2
- package/dist/src/api/models/sub-account.d.ts +1 -1
- package/dist/src/api/models/sub-account.js +1 -2
- package/dist/src/api/models/supplied.d.ts +1 -1
- package/dist/src/api/models/supplied.js +1 -2
- package/dist/src/api/models/tag.js +1 -2
- package/dist/src/api/models/tvl-history.js +1 -2
- package/dist/src/api/models/ultra-coin-info.js +1 -2
- package/dist/src/api/models/update-vault-strategies.d.ts +1 -1
- package/dist/src/api/models/update-vault-strategies.js +1 -2
- package/dist/src/api/models/vault-admin-changed-event.js +1 -2
- package/dist/src/api/models/vault-created-event.js +1 -2
- package/dist/src/api/models/vault-deposit-event.js +1 -2
- package/dist/src/api/models/vault-deposit-without-minting-shares-event.js +1 -2
- package/dist/src/api/models/vault-detail.d.ts +7 -7
- package/dist/src/api/models/vault-detail.js +1 -4
- package/dist/src/api/models/vault-fee-percentage-updated-event.js +1 -2
- package/dist/src/api/models/vault-info.js +1 -2
- package/dist/src/api/models/vault-max-tvl-updated-event.js +1 -2
- package/dist/src/api/models/vault-operator-changed-event.js +1 -2
- package/dist/src/api/models/vault-paused-status-updated-event.js +1 -2
- package/dist/src/api/models/vault-platform-fee-charged-event.js +1 -2
- package/dist/src/api/models/vault-protocol.js +1 -2
- package/dist/src/api/models/vault-rate-updated-event.js +1 -2
- package/dist/src/api/models/vault-slice.js +1 -2
- package/dist/src/api/models/vault-sub-account-updated-event.js +1 -2
- package/dist/src/api/models/vault-withdrawal-without-redeeming-shares-event.js +1 -2
- package/dist/src/api/models/vaults-stats.js +1 -2
- package/dist/src/api/models/yield-aggregate-value.js +1 -2
- package/dist/src/api/v2/api.d.ts +2 -2
- package/dist/src/api/v2/api.js +2 -18
- package/dist/src/api/v2/apis/accounts-api.d.ts +9 -9
- package/dist/src/api/v2/apis/accounts-api.js +56 -66
- package/dist/src/api/v2/apis/vaults-api.d.ts +20 -20
- package/dist/src/api/v2/apis/vaults-api.js +114 -124
- package/dist/src/api/v2/base.d.ts +1 -1
- package/dist/src/api/v2/base.js +7 -15
- package/dist/src/api/v2/common.d.ts +2 -2
- package/dist/src/api/v2/common.js +13 -25
- package/dist/src/api/v2/configuration.js +2 -6
- package/dist/src/api/v2/index.d.ts +3 -3
- package/dist/src/api/v2/index.js +3 -19
- package/dist/src/api/v2/models/account-transaction-transaction-data.d.ts +5 -5
- package/dist/src/api/v2/models/account-transaction-transaction-data.js +1 -2
- package/dist/src/api/v2/models/account-transaction.d.ts +1 -1
- package/dist/src/api/v2/models/account-transaction.js +1 -4
- package/dist/src/api/v2/models/account-vault-position-history.js +1 -4
- package/dist/src/api/v2/models/account-withdrawal-request.d.ts +2 -2
- package/dist/src/api/v2/models/account-withdrawal-request.js +1 -4
- package/dist/src/api/v2/models/aggregated-account-position-history.js +1 -4
- package/dist/src/api/v2/models/aggregated-proof-of-capital-report.d.ts +2 -2
- package/dist/src/api/v2/models/aggregated-proof-of-capital-report.js +1 -2
- package/dist/src/api/v2/models/apy-averages.d.ts +1 -1
- package/dist/src/api/v2/models/apy-averages.js +1 -2
- package/dist/src/api/v2/models/apy-history-response.d.ts +1 -1
- package/dist/src/api/v2/models/apy-history-response.js +1 -2
- package/dist/src/api/v2/models/apy-history.js +1 -2
- package/dist/src/api/v2/models/apy-period-average.js +1 -2
- package/dist/src/api/v2/models/asset.js +1 -2
- package/dist/src/api/v2/models/borrowed.d.ts +1 -1
- package/dist/src/api/v2/models/borrowed.js +1 -2
- package/dist/src/api/v2/models/chain-vault-details.d.ts +2 -2
- package/dist/src/api/v2/models/chain-vault-details.js +1 -2
- package/dist/src/api/v2/models/chain.d.ts +6 -0
- package/dist/src/api/v2/models/chain.js +1 -4
- package/dist/src/api/v2/models/coin-price.js +1 -2
- package/dist/src/api/v2/models/deposit-transaction.d.ts +2 -2
- package/dist/src/api/v2/models/deposit-transaction.js +1 -2
- package/dist/src/api/v2/models/ember-position.d.ts +1 -1
- package/dist/src/api/v2/models/ember-position.js +1 -2
- package/dist/src/api/v2/models/evm-contracts.d.ts +14 -5
- package/dist/src/api/v2/models/evm-contracts.js +1 -2
- package/dist/src/api/v2/models/evm-deposit-token.js +1 -2
- package/dist/src/api/v2/models/evm-oftadapter.d.ts +93 -0
- package/dist/src/api/v2/models/evm-oftadapter.js +14 -0
- package/dist/src/api/v2/models/evm-oftpeer.d.ts +48 -0
- package/dist/src/api/v2/models/evm-oftpeer.js +14 -0
- package/dist/src/api/v2/models/evm-price-feed.js +1 -2
- package/dist/src/api/v2/models/evm-protocol-config.d.ts +6 -0
- package/dist/src/api/v2/models/evm-protocol-config.js +1 -2
- package/dist/src/api/v2/models/evm-protocol-info.d.ts +1 -1
- package/dist/src/api/v2/models/evm-protocol-info.js +1 -2
- package/dist/src/api/v2/models/evm-receipt-token.js +1 -2
- package/dist/src/api/v2/models/evm-vault.d.ts +24 -0
- package/dist/src/api/v2/models/evm-vault.js +1 -2
- package/dist/src/api/v2/models/exposure-coin.d.ts +1 -1
- package/dist/src/api/v2/models/exposure-coin.js +1 -2
- package/dist/src/api/v2/models/exposure-protocol.d.ts +6 -6
- package/dist/src/api/v2/models/exposure-protocol.js +1 -2
- package/dist/src/api/v2/models/exposure.d.ts +2 -2
- package/dist/src/api/v2/models/exposure.js +1 -2
- package/dist/src/api/v2/models/fee.d.ts +1 -1
- package/dist/src/api/v2/models/fee.js +1 -2
- package/dist/src/api/v2/models/fees.js +1 -2
- package/dist/src/api/v2/models/history-interval.js +1 -4
- package/dist/src/api/v2/models/index.d.ts +102 -100
- package/dist/src/api/v2/models/index.js +102 -116
- package/dist/src/api/v2/models/lp.d.ts +3 -3
- package/dist/src/api/v2/models/lp.js +1 -2
- package/dist/src/api/v2/models/manager.js +1 -2
- package/dist/src/api/v2/models/min-withdrawal-shares-updated-event.js +1 -2
- package/dist/src/api/v2/models/perps.d.ts +1 -1
- package/dist/src/api/v2/models/perps.js +1 -2
- package/dist/src/api/v2/models/pnl-by-chain.js +1 -2
- package/dist/src/api/v2/models/pnl-history-interval.js +1 -4
- package/dist/src/api/v2/models/pnl-history.js +1 -2
- package/dist/src/api/v2/models/poc-report-asset.js +1 -2
- package/dist/src/api/v2/models/poc-report-assets.d.ts +1 -1
- package/dist/src/api/v2/models/poc-report-assets.js +1 -2
- package/dist/src/api/v2/models/poc-report-exchange.d.ts +1 -1
- package/dist/src/api/v2/models/poc-report-exchange.js +1 -2
- package/dist/src/api/v2/models/poc-report-exchanges.d.ts +1 -1
- package/dist/src/api/v2/models/poc-report-exchanges.js +1 -2
- package/dist/src/api/v2/models/poc-report-protocol.js +1 -2
- package/dist/src/api/v2/models/poc-report-token.js +1 -2
- package/dist/src/api/v2/models/poc-report-wallet.d.ts +2 -2
- package/dist/src/api/v2/models/poc-report-wallet.js +1 -2
- package/dist/src/api/v2/models/poc-report-wallets.d.ts +1 -1
- package/dist/src/api/v2/models/poc-report-wallets.js +1 -2
- package/dist/src/api/v2/models/position-history-interval.js +1 -4
- package/dist/src/api/v2/models/position-value.js +1 -4
- package/dist/src/api/v2/models/position.js +1 -2
- package/dist/src/api/v2/models/process-requests-summary-event.js +1 -2
- package/dist/src/api/v2/models/proof-of-capital-report-status.js +1 -4
- package/dist/src/api/v2/models/proof-of-capital-report.d.ts +4 -4
- package/dist/src/api/v2/models/proof-of-capital-report.js +1 -2
- package/dist/src/api/v2/models/protocol-fee-collected-event.js +1 -2
- package/dist/src/api/v2/models/protocol-pnl-history.js +1 -2
- package/dist/src/api/v2/models/protocol-tvl-history.js +1 -2
- package/dist/src/api/v2/models/protocol.js +1 -2
- package/dist/src/api/v2/models/raw-event-event-data.d.ts +17 -17
- package/dist/src/api/v2/models/raw-event-event-data.js +1 -2
- package/dist/src/api/v2/models/raw-event.d.ts +1 -1
- package/dist/src/api/v2/models/raw-event.js +1 -4
- package/dist/src/api/v2/models/redeem-request-cancelled-transaction.d.ts +2 -2
- package/dist/src/api/v2/models/redeem-request-cancelled-transaction.js +1 -2
- package/dist/src/api/v2/models/redeem-request-processed-transaction.d.ts +2 -2
- package/dist/src/api/v2/models/redeem-request-processed-transaction.js +1 -2
- package/dist/src/api/v2/models/redeem-request-skipped-transaction.d.ts +2 -2
- package/dist/src/api/v2/models/redeem-request-skipped-transaction.js +1 -2
- package/dist/src/api/v2/models/redeem-request-transaction.d.ts +2 -2
- package/dist/src/api/v2/models/redeem-request-transaction.js +1 -2
- package/dist/src/api/v2/models/reported-apy.js +1 -2
- package/dist/src/api/v2/models/request-processed-event.js +1 -2
- package/dist/src/api/v2/models/request-redeemed-event.js +1 -2
- package/dist/src/api/v2/models/reward-token.js +1 -2
- package/dist/src/api/v2/models/reward.d.ts +1 -1
- package/dist/src/api/v2/models/reward.js +1 -2
- package/dist/src/api/v2/models/share-price-history.js +1 -2
- package/dist/src/api/v2/models/strategy-account.d.ts +1 -1
- package/dist/src/api/v2/models/strategy-account.js +1 -2
- package/dist/src/api/v2/models/strategy.js +1 -2
- package/dist/src/api/v2/models/sub-account.d.ts +1 -1
- package/dist/src/api/v2/models/sub-account.js +1 -2
- package/dist/src/api/v2/models/sui-protocol-info.d.ts +3 -3
- package/dist/src/api/v2/models/sui-protocol-info.js +1 -2
- package/dist/src/api/v2/models/supplied.d.ts +1 -1
- package/dist/src/api/v2/models/supplied.js +1 -2
- package/dist/src/api/v2/models/tag.js +1 -2
- package/dist/src/api/v2/models/tvl-by-chain.js +1 -2
- package/dist/src/api/v2/models/tvl-history.d.ts +1 -1
- package/dist/src/api/v2/models/tvl-history.js +1 -2
- package/dist/src/api/v2/models/ultra-coin-info.js +1 -2
- package/dist/src/api/v2/models/update-vault-strategies.d.ts +1 -1
- package/dist/src/api/v2/models/update-vault-strategies.js +1 -2
- package/dist/src/api/v2/models/vault-admin-changed-event.js +1 -2
- package/dist/src/api/v2/models/vault-created-event.js +1 -2
- package/dist/src/api/v2/models/vault-deposit-eligibility.js +1 -2
- package/dist/src/api/v2/models/vault-deposit-event.js +1 -2
- package/dist/src/api/v2/models/vault-deposit-without-minting-shares-event.js +1 -2
- package/dist/src/api/v2/models/vault-detail.d.ts +8 -8
- package/dist/src/api/v2/models/vault-detail.js +1 -4
- package/dist/src/api/v2/models/vault-fee-percentage-updated-event.js +1 -2
- package/dist/src/api/v2/models/vault-info.js +1 -2
- package/dist/src/api/v2/models/vault-max-tvl-updated-event.js +1 -2
- package/dist/src/api/v2/models/vault-operator-changed-event.js +1 -2
- package/dist/src/api/v2/models/vault-paused-status-updated-event.js +1 -2
- package/dist/src/api/v2/models/vault-platform-fee-charged-event.js +1 -2
- package/dist/src/api/v2/models/vault-proof-of-capital-summary.d.ts +2 -2
- package/dist/src/api/v2/models/vault-proof-of-capital-summary.js +1 -2
- package/dist/src/api/v2/models/vault-protocol.js +1 -2
- package/dist/src/api/v2/models/vault-rate-updated-event.js +1 -2
- package/dist/src/api/v2/models/vault-slice.js +1 -2
- package/dist/src/api/v2/models/vault-sub-account-updated-event.js +1 -2
- package/dist/src/api/v2/models/vault-tag.js +1 -2
- package/dist/src/api/v2/models/vault-withdrawal-without-redeeming-shares-event.js +1 -2
- package/dist/src/api/v2/models/vaults-deployment-config-config.d.ts +2 -2
- package/dist/src/api/v2/models/vaults-deployment-config-config.js +1 -2
- package/dist/src/api/v2/models/vaults-deployment-config.d.ts +1 -1
- package/dist/src/api/v2/models/vaults-deployment-config.js +1 -4
- package/dist/src/api/v2/models/vaults-stats.js +1 -2
- package/dist/src/api/v2/models/yield-aggregate-value.js +1 -2
- package/dist/src/common/constants.d.ts +8 -0
- package/dist/src/common/constants.js +11 -0
- package/dist/src/common/types.js +1 -2
- package/dist/src/ember-vaults.d.ts +23 -24
- package/dist/src/ember-vaults.js +35 -49
- package/dist/src/evm-vaults/index.d.ts +15 -3
- package/dist/src/evm-vaults/index.js +21 -19
- package/dist/src/evm-vaults/interfaces/index.d.ts +92 -47
- package/dist/src/evm-vaults/interfaces/index.js +1 -2
- package/dist/src/evm-vaults/on-chain-calls/admin.d.ts +4 -4
- package/dist/src/evm-vaults/on-chain-calls/admin.js +2 -6
- package/dist/src/evm-vaults/on-chain-calls/index.d.ts +7 -7
- package/dist/src/evm-vaults/on-chain-calls/index.js +7 -23
- package/dist/src/evm-vaults/on-chain-calls/onchain-calls.d.ts +5 -5
- package/dist/src/evm-vaults/on-chain-calls/onchain-calls.js +9 -13
- package/dist/src/evm-vaults/on-chain-calls/operator.d.ts +4 -4
- package/dist/src/evm-vaults/on-chain-calls/operator.js +2 -6
- package/dist/src/evm-vaults/on-chain-calls/tx-builder.d.ts +24 -5
- package/dist/src/evm-vaults/on-chain-calls/tx-builder.js +83 -41
- package/dist/src/evm-vaults/on-chain-calls/user.d.ts +20 -4
- package/dist/src/evm-vaults/on-chain-calls/user.js +61 -15
- package/dist/src/evm-vaults/on-chain-calls/vault-admin.d.ts +4 -4
- package/dist/src/evm-vaults/on-chain-calls/vault-admin.js +2 -6
- package/dist/src/evm-vaults/on-chain-calls/vault-reader.d.ts +39 -5
- package/dist/src/evm-vaults/on-chain-calls/vault-reader.js +119 -20
- package/dist/src/evm-vaults/utils/deployment-parser.d.ts +14 -8
- package/dist/src/evm-vaults/utils/deployment-parser.js +22 -15
- package/dist/src/evm-vaults/utils/index.d.ts +2 -2
- package/dist/src/evm-vaults/utils/index.js +2 -18
- package/dist/src/evm-vaults/utils/permit-utils.d.ts +2 -2
- package/dist/src/evm-vaults/utils/permit-utils.js +12 -53
- package/dist/src/index.d.ts +3 -3
- package/dist/src/index.js +3 -19
- package/dist/src/sui-vaults/index.d.ts +4 -4
- package/dist/src/sui-vaults/index.js +4 -20
- package/dist/src/sui-vaults/interfaces/bcs.js +15 -18
- package/dist/src/sui-vaults/interfaces/index.js +1 -2
- package/dist/src/sui-vaults/on-chain-calls/admin.d.ts +2 -2
- package/dist/src/sui-vaults/on-chain-calls/admin.js +13 -17
- package/dist/src/sui-vaults/on-chain-calls/index.d.ts +6 -6
- package/dist/src/sui-vaults/on-chain-calls/index.js +6 -22
- package/dist/src/sui-vaults/on-chain-calls/onchain-calls.d.ts +3 -3
- package/dist/src/sui-vaults/on-chain-calls/onchain-calls.js +8 -12
- package/dist/src/sui-vaults/on-chain-calls/operator.d.ts +2 -2
- package/dist/src/sui-vaults/on-chain-calls/operator.js +15 -19
- package/dist/src/sui-vaults/on-chain-calls/tx-builder.d.ts +2 -2
- package/dist/src/sui-vaults/on-chain-calls/tx-builder.js +46 -50
- package/dist/src/sui-vaults/on-chain-calls/user.d.ts +2 -2
- package/dist/src/sui-vaults/on-chain-calls/user.js +18 -22
- package/dist/src/sui-vaults/on-chain-calls/vault-admin.d.ts +2 -2
- package/dist/src/sui-vaults/on-chain-calls/vault-admin.js +10 -14
- package/dist/src/sui-vaults/on-chain-calls/vault.d.ts +1 -1
- package/dist/src/sui-vaults/on-chain-calls/vault.js +41 -30
- package/dist/src/sui-vaults/utils/common.js +3 -7
- package/dist/src/sui-vaults/utils/deployment-parser.d.ts +1 -1
- package/dist/src/sui-vaults/utils/deployment-parser.js +1 -5
- package/dist/src/sui-vaults/utils/index.d.ts +2 -2
- package/dist/src/sui-vaults/utils/index.js +2 -18
- package/package.json +28 -14
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const utils_1 = require("../utils");
|
|
8
|
-
const EmberVault_json_1 = __importDefault(require("../../abis/EmberVault.json"));
|
|
9
|
-
const EmberETHVault_json_1 = __importDefault(require("../../abis/EmberETHVault.json"));
|
|
10
|
-
const EmberProtocolConfig_json_1 = __importDefault(require("../../abis/EmberProtocolConfig.json"));
|
|
11
|
-
const ERC20Token_json_1 = __importDefault(require("../../abis/ERC20Token.json"));
|
|
1
|
+
import { EVMDeploymentParser } from "../utils/index.js";
|
|
2
|
+
import EmberVaultABI from "../../abis/EmberVault.json" with { type: "json" };
|
|
3
|
+
import EmberETHVaultABI from "../../abis/EmberETHVault.json" with { type: "json" };
|
|
4
|
+
import EmberProtocolConfigABI from "../../abis/EmberProtocolConfig.json" with { type: "json" };
|
|
5
|
+
import ERC20TokenABI from "../../abis/ERC20Token.json" with { type: "json" };
|
|
6
|
+
import EmberVaultOFTAdapterABI from "../../abis/EmberVaultMintBurnOFTAdapter.json" with { type: "json" };
|
|
12
7
|
/**
|
|
13
8
|
* EVM Transaction Builder for Ember Protocol (ERC-4626 Compatible)
|
|
14
9
|
*
|
|
@@ -44,9 +39,9 @@ const ERC20Token_json_1 = __importDefault(require("../../abis/ERC20Token.json"))
|
|
|
44
39
|
* await contract[txCall.functionName](...txCall.args);
|
|
45
40
|
* ```
|
|
46
41
|
*/
|
|
47
|
-
class EVMTxBuilder {
|
|
42
|
+
export class EVMTxBuilder {
|
|
48
43
|
constructor(_deployment) {
|
|
49
|
-
this.parser = new
|
|
44
|
+
this.parser = new EVMDeploymentParser(_deployment);
|
|
50
45
|
}
|
|
51
46
|
/**
|
|
52
47
|
* Updates the deployment configuration
|
|
@@ -67,7 +62,7 @@ class EVMTxBuilder {
|
|
|
67
62
|
* @returns The vault ABI array
|
|
68
63
|
*/
|
|
69
64
|
getVaultAbiForType(isETHVault) {
|
|
70
|
-
return isETHVault ?
|
|
65
|
+
return isETHVault ? EmberETHVaultABI.abi : EmberVaultABI.abi;
|
|
71
66
|
}
|
|
72
67
|
// ============================================
|
|
73
68
|
// Protocol Config Admin Methods
|
|
@@ -82,7 +77,7 @@ class EVMTxBuilder {
|
|
|
82
77
|
to: this.parser.getProtocolConfigAddress(),
|
|
83
78
|
functionName: "pauseNonAdminOperations",
|
|
84
79
|
args: [pause],
|
|
85
|
-
abi:
|
|
80
|
+
abi: EmberProtocolConfigABI.abi,
|
|
86
81
|
value: 0n,
|
|
87
82
|
chainId: this.getChainId()
|
|
88
83
|
};
|
|
@@ -97,7 +92,7 @@ class EVMTxBuilder {
|
|
|
97
92
|
to: this.parser.getProtocolConfigAddress(),
|
|
98
93
|
functionName: "updatePlatformFeeRecipient",
|
|
99
94
|
args: [recipient],
|
|
100
|
-
abi:
|
|
95
|
+
abi: EmberProtocolConfigABI.abi,
|
|
101
96
|
value: 0n,
|
|
102
97
|
chainId: this.getChainId()
|
|
103
98
|
};
|
|
@@ -112,7 +107,7 @@ class EVMTxBuilder {
|
|
|
112
107
|
to: this.parser.getProtocolConfigAddress(),
|
|
113
108
|
functionName: "updateMinRate",
|
|
114
109
|
args: [BigInt(minRate)],
|
|
115
|
-
abi:
|
|
110
|
+
abi: EmberProtocolConfigABI.abi,
|
|
116
111
|
value: 0n,
|
|
117
112
|
chainId: this.getChainId()
|
|
118
113
|
};
|
|
@@ -127,7 +122,7 @@ class EVMTxBuilder {
|
|
|
127
122
|
to: this.parser.getProtocolConfigAddress(),
|
|
128
123
|
functionName: "updateMaxRate",
|
|
129
124
|
args: [BigInt(maxRate)],
|
|
130
|
-
abi:
|
|
125
|
+
abi: EmberProtocolConfigABI.abi,
|
|
131
126
|
value: 0n,
|
|
132
127
|
chainId: this.getChainId()
|
|
133
128
|
};
|
|
@@ -142,7 +137,7 @@ class EVMTxBuilder {
|
|
|
142
137
|
to: this.parser.getProtocolConfigAddress(),
|
|
143
138
|
functionName: "updateMaxRateInterval",
|
|
144
139
|
args: [BigInt(maxRateInterval)],
|
|
145
|
-
abi:
|
|
140
|
+
abi: EmberProtocolConfigABI.abi,
|
|
146
141
|
value: 0n,
|
|
147
142
|
chainId: this.getChainId()
|
|
148
143
|
};
|
|
@@ -157,7 +152,7 @@ class EVMTxBuilder {
|
|
|
157
152
|
to: this.parser.getProtocolConfigAddress(),
|
|
158
153
|
functionName: "updateMinRateInterval",
|
|
159
154
|
args: [BigInt(minRateInterval)],
|
|
160
|
-
abi:
|
|
155
|
+
abi: EmberProtocolConfigABI.abi,
|
|
161
156
|
value: 0n,
|
|
162
157
|
chainId: this.getChainId()
|
|
163
158
|
};
|
|
@@ -172,7 +167,7 @@ class EVMTxBuilder {
|
|
|
172
167
|
to: this.parser.getProtocolConfigAddress(),
|
|
173
168
|
functionName: "updateDefaultRate",
|
|
174
169
|
args: [BigInt(defaultRate)],
|
|
175
|
-
abi:
|
|
170
|
+
abi: EmberProtocolConfigABI.abi,
|
|
176
171
|
value: 0n,
|
|
177
172
|
chainId: this.getChainId()
|
|
178
173
|
};
|
|
@@ -187,7 +182,7 @@ class EVMTxBuilder {
|
|
|
187
182
|
to: this.parser.getProtocolConfigAddress(),
|
|
188
183
|
functionName: "updateMaxFeePercentage",
|
|
189
184
|
args: [BigInt(maxFeePercentage)],
|
|
190
|
-
abi:
|
|
185
|
+
abi: EmberProtocolConfigABI.abi,
|
|
191
186
|
value: 0n,
|
|
192
187
|
chainId: this.getChainId()
|
|
193
188
|
};
|
|
@@ -203,7 +198,7 @@ class EVMTxBuilder {
|
|
|
203
198
|
to: this.parser.getProtocolConfigAddress(),
|
|
204
199
|
functionName: "setBlacklistedAccount",
|
|
205
200
|
args: [account, isBlacklisted],
|
|
206
|
-
abi:
|
|
201
|
+
abi: EmberProtocolConfigABI.abi,
|
|
207
202
|
value: 0n,
|
|
208
203
|
chainId: this.getChainId()
|
|
209
204
|
};
|
|
@@ -224,7 +219,7 @@ class EVMTxBuilder {
|
|
|
224
219
|
to: this.parser.getProtocolConfigAddress(),
|
|
225
220
|
functionName: "updateVaultAdmin",
|
|
226
221
|
args: [vaultAddress, newAdmin],
|
|
227
|
-
abi:
|
|
222
|
+
abi: EmberProtocolConfigABI.abi,
|
|
228
223
|
value: 0n,
|
|
229
224
|
chainId: this.getChainId()
|
|
230
225
|
};
|
|
@@ -241,7 +236,7 @@ class EVMTxBuilder {
|
|
|
241
236
|
to: this.parser.getProtocolConfigAddress(),
|
|
242
237
|
functionName: "setVaultPausedStatus",
|
|
243
238
|
args: [vaultAddress, operation, paused],
|
|
244
|
-
abi:
|
|
239
|
+
abi: EmberProtocolConfigABI.abi,
|
|
245
240
|
value: 0n,
|
|
246
241
|
chainId: this.getChainId()
|
|
247
242
|
};
|
|
@@ -257,7 +252,7 @@ class EVMTxBuilder {
|
|
|
257
252
|
to: this.parser.getProtocolConfigAddress(),
|
|
258
253
|
functionName: "updateVaultOperator",
|
|
259
254
|
args: [vaultAddress, newOperator],
|
|
260
|
-
abi:
|
|
255
|
+
abi: EmberProtocolConfigABI.abi,
|
|
261
256
|
value: 0n,
|
|
262
257
|
chainId: this.getChainId()
|
|
263
258
|
};
|
|
@@ -273,7 +268,7 @@ class EVMTxBuilder {
|
|
|
273
268
|
to: this.parser.getProtocolConfigAddress(),
|
|
274
269
|
functionName: "updateVaultRateManager",
|
|
275
270
|
args: [vaultAddress, newRateManager],
|
|
276
|
-
abi:
|
|
271
|
+
abi: EmberProtocolConfigABI.abi,
|
|
277
272
|
value: 0n,
|
|
278
273
|
chainId: this.getChainId()
|
|
279
274
|
};
|
|
@@ -289,7 +284,7 @@ class EVMTxBuilder {
|
|
|
289
284
|
to: this.parser.getProtocolConfigAddress(),
|
|
290
285
|
functionName: "updateVaultMinWithdrawableShares",
|
|
291
286
|
args: [vaultAddress, BigInt(minWithdrawableShares)],
|
|
292
|
-
abi:
|
|
287
|
+
abi: EmberProtocolConfigABI.abi,
|
|
293
288
|
value: 0n,
|
|
294
289
|
chainId: this.getChainId()
|
|
295
290
|
};
|
|
@@ -306,7 +301,7 @@ class EVMTxBuilder {
|
|
|
306
301
|
to: this.parser.getProtocolConfigAddress(),
|
|
307
302
|
functionName: "setVaultSubAccount",
|
|
308
303
|
args: [vaultAddress, account, isSubAccount],
|
|
309
|
-
abi:
|
|
304
|
+
abi: EmberProtocolConfigABI.abi,
|
|
310
305
|
value: 0n,
|
|
311
306
|
chainId: this.getChainId()
|
|
312
307
|
};
|
|
@@ -322,7 +317,7 @@ class EVMTxBuilder {
|
|
|
322
317
|
to: this.parser.getProtocolConfigAddress(),
|
|
323
318
|
functionName: "updateVaultMaxTVL",
|
|
324
319
|
args: [vaultAddress, BigInt(maxTVL)],
|
|
325
|
-
abi:
|
|
320
|
+
abi: EmberProtocolConfigABI.abi,
|
|
326
321
|
value: 0n,
|
|
327
322
|
chainId: this.getChainId()
|
|
328
323
|
};
|
|
@@ -338,7 +333,7 @@ class EVMTxBuilder {
|
|
|
338
333
|
to: this.parser.getProtocolConfigAddress(),
|
|
339
334
|
functionName: "updateVaultRateUpdateInterval",
|
|
340
335
|
args: [vaultAddress, BigInt(newInterval)],
|
|
341
|
-
abi:
|
|
336
|
+
abi: EmberProtocolConfigABI.abi,
|
|
342
337
|
value: 0n,
|
|
343
338
|
chainId: this.getChainId()
|
|
344
339
|
};
|
|
@@ -354,7 +349,7 @@ class EVMTxBuilder {
|
|
|
354
349
|
to: this.parser.getProtocolConfigAddress(),
|
|
355
350
|
functionName: "updateVaultFeePercentage",
|
|
356
351
|
args: [vaultAddress, BigInt(newFeePercentage)],
|
|
357
|
-
abi:
|
|
352
|
+
abi: EmberProtocolConfigABI.abi,
|
|
358
353
|
value: 0n,
|
|
359
354
|
chainId: this.getChainId()
|
|
360
355
|
};
|
|
@@ -370,7 +365,7 @@ class EVMTxBuilder {
|
|
|
370
365
|
to: this.parser.getProtocolConfigAddress(),
|
|
371
366
|
functionName: "updateVaultName",
|
|
372
367
|
args: [vaultAddress, newName],
|
|
373
|
-
abi:
|
|
368
|
+
abi: EmberProtocolConfigABI.abi,
|
|
374
369
|
value: 0n,
|
|
375
370
|
chainId: this.getChainId()
|
|
376
371
|
};
|
|
@@ -573,7 +568,7 @@ class EVMTxBuilder {
|
|
|
573
568
|
to: vaultAddress,
|
|
574
569
|
functionName: "depositETH",
|
|
575
570
|
args: [receiver],
|
|
576
|
-
abi:
|
|
571
|
+
abi: EmberETHVaultABI.abi,
|
|
577
572
|
value,
|
|
578
573
|
chainId: this.getChainId()
|
|
579
574
|
};
|
|
@@ -591,7 +586,7 @@ class EVMTxBuilder {
|
|
|
591
586
|
to: vaultAddress,
|
|
592
587
|
functionName: "mintWithETH",
|
|
593
588
|
args: [BigInt(shares), receiver],
|
|
594
|
-
abi:
|
|
589
|
+
abi: EmberETHVaultABI.abi,
|
|
595
590
|
value,
|
|
596
591
|
chainId: this.getChainId()
|
|
597
592
|
};
|
|
@@ -628,7 +623,7 @@ class EVMTxBuilder {
|
|
|
628
623
|
to: tokenAddress,
|
|
629
624
|
functionName: "approve",
|
|
630
625
|
args: [spender, BigInt(amount)],
|
|
631
|
-
abi:
|
|
626
|
+
abi: ERC20TokenABI.abi,
|
|
632
627
|
value: 0n,
|
|
633
628
|
chainId: this.getChainId()
|
|
634
629
|
};
|
|
@@ -640,25 +635,72 @@ class EVMTxBuilder {
|
|
|
640
635
|
* Gets the EmberVault ABI (standard ERC20 vault)
|
|
641
636
|
*/
|
|
642
637
|
static getVaultABI() {
|
|
643
|
-
return
|
|
638
|
+
return EmberVaultABI.abi;
|
|
644
639
|
}
|
|
645
640
|
/**
|
|
646
641
|
* Gets the EmberETHVault ABI (native ETH vault)
|
|
647
642
|
*/
|
|
648
643
|
static getETHVaultABI() {
|
|
649
|
-
return
|
|
644
|
+
return EmberETHVaultABI.abi;
|
|
650
645
|
}
|
|
651
646
|
/**
|
|
652
647
|
* Gets the EmberProtocolConfig ABI
|
|
653
648
|
*/
|
|
654
649
|
static getProtocolConfigABI() {
|
|
655
|
-
return
|
|
650
|
+
return EmberProtocolConfigABI.abi;
|
|
656
651
|
}
|
|
657
652
|
/**
|
|
658
653
|
* Gets the ERC20Token ABI
|
|
659
654
|
*/
|
|
660
655
|
static getERC20ABI() {
|
|
661
|
-
return
|
|
656
|
+
return ERC20TokenABI.abi;
|
|
657
|
+
}
|
|
658
|
+
/**
|
|
659
|
+
* Gets the EmberVaultOFTAdapter ABI
|
|
660
|
+
*/
|
|
661
|
+
static getOFTAdapterABI() {
|
|
662
|
+
return EmberVaultOFTAdapterABI.abi;
|
|
663
|
+
}
|
|
664
|
+
// ============================================
|
|
665
|
+
// Bridge / OFT Methods (LayerZero)
|
|
666
|
+
// ============================================
|
|
667
|
+
/**
|
|
668
|
+
* Builds the transaction to bridge receipt tokens to another chain via LayerZero OFT.
|
|
669
|
+
*
|
|
670
|
+
* The caller must first:
|
|
671
|
+
* 1. Approve the adapter to spend the receipt token (`approveToken`).
|
|
672
|
+
* 2. Obtain a fee quote (`EVMVaultReader.getOFTFeeQuote`) and pass the result as `fee`.
|
|
673
|
+
* Set `value` on the returned `ITransactionCall` to `fee.nativeFee`.
|
|
674
|
+
*
|
|
675
|
+
* @param adapterAddress The OFT adapter contract address
|
|
676
|
+
* @param sendParam The bridge send parameters (destination, recipient, amounts, options)
|
|
677
|
+
* @param fee The messaging fee (native + LZ token fee) obtained from a prior quote
|
|
678
|
+
* @param refundAddress Address to receive any excess native fee refund
|
|
679
|
+
* @returns Transaction call object
|
|
680
|
+
*/
|
|
681
|
+
bridgeSend(adapterAddress, sendParam, fee, refundAddress) {
|
|
682
|
+
return {
|
|
683
|
+
to: adapterAddress,
|
|
684
|
+
functionName: "send",
|
|
685
|
+
args: [
|
|
686
|
+
{
|
|
687
|
+
dstEid: sendParam.dstEid,
|
|
688
|
+
to: sendParam.to,
|
|
689
|
+
amountLD: sendParam.amountLD,
|
|
690
|
+
minAmountLD: sendParam.minAmountLD,
|
|
691
|
+
extraOptions: sendParam.extraOptions ?? "0x",
|
|
692
|
+
composeMsg: sendParam.composeMsg ?? "0x",
|
|
693
|
+
oftCmd: sendParam.oftCmd ?? "0x"
|
|
694
|
+
},
|
|
695
|
+
{
|
|
696
|
+
nativeFee: fee.nativeFee,
|
|
697
|
+
lzTokenFee: fee.lzTokenFee
|
|
698
|
+
},
|
|
699
|
+
refundAddress
|
|
700
|
+
],
|
|
701
|
+
abi: EmberVaultOFTAdapterABI.abi,
|
|
702
|
+
value: fee.nativeFee,
|
|
703
|
+
chainId: this.getChainId()
|
|
704
|
+
};
|
|
662
705
|
}
|
|
663
706
|
}
|
|
664
|
-
exports.EVMTxBuilder = EVMTxBuilder;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Signer, Provider } from "ethers";
|
|
2
|
-
import { EVMOnChainCalls } from "./onchain-calls";
|
|
3
|
-
import {
|
|
4
|
-
import { NumStr } from "../../common/types";
|
|
2
|
+
import { EVMOnChainCalls } from "./onchain-calls.js";
|
|
3
|
+
import { EvmProtocolInfo, IUserCallOptions, IEvmCallOptions, EvmOnChainCallResponse, IPermitSignature, IETHDepositOptions, IBridgeSendOptions, IOFTFeeQuote } from "../interfaces/index.js";
|
|
4
|
+
import { NumStr } from "../../common/types.js";
|
|
5
|
+
import { Chain } from "../../api/v2/index.js";
|
|
5
6
|
/**
|
|
6
7
|
* User Calls for Ember Protocol on EVM (ERC-4626 Compatible)
|
|
7
8
|
*
|
|
@@ -49,7 +50,7 @@ import { NumStr } from "../../common/types";
|
|
|
49
50
|
* ```
|
|
50
51
|
*/
|
|
51
52
|
export declare class EVMUserCalls extends EVMOnChainCalls {
|
|
52
|
-
constructor(_deployment:
|
|
53
|
+
constructor(_deployment: EvmProtocolInfo, _signer?: Signer, _provider?: Provider, _walletAddress?: string);
|
|
53
54
|
/**
|
|
54
55
|
* Deposit assets into a vault (ERC-4626 standard)
|
|
55
56
|
*
|
|
@@ -225,6 +226,21 @@ export declare class EVMUserCalls extends EVMOnChainCalls {
|
|
|
225
226
|
* @returns EvmOnChainCallResponse
|
|
226
227
|
*/
|
|
227
228
|
approveTokenMax(tokenAddress: string, spender: string, options?: IEvmCallOptions): Promise<EvmOnChainCallResponse>;
|
|
229
|
+
/**
|
|
230
|
+
* Bridges a receipt token to a destination chain using the configured OFT adapter.
|
|
231
|
+
*
|
|
232
|
+
* This method validates allowance, builds the LayerZero send parameters,
|
|
233
|
+
* and executes the adapter send transaction.
|
|
234
|
+
*
|
|
235
|
+
* @param destinationChain Destination chain metadata (must include lzChainId)
|
|
236
|
+
* @param tokenAddress Receipt token address (also used as vault identifier in EVM deployment data)
|
|
237
|
+
* @param amount Amount to bridge in local token decimals
|
|
238
|
+
* @param receiver Recipient wallet address on destination chain
|
|
239
|
+
* @param feeQuote Fee quote returned by reader.getOFTFeeQuote
|
|
240
|
+
* @param options Optional bridge/send overrides
|
|
241
|
+
* @returns Transaction execution response
|
|
242
|
+
*/
|
|
243
|
+
bridgeSendToken(destinationChain: Chain, tokenAddress: string, amount: NumStr, receiver: string, feeQuote: IOFTFeeQuote, options?: IBridgeSendOptions): Promise<EvmOnChainCallResponse>;
|
|
228
244
|
/**
|
|
229
245
|
* Gets the vault contract instance for read operations
|
|
230
246
|
* @param vaultAddress The address of the vault
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
exports.EVMUserCalls = void 0;
|
|
7
|
-
const ethers_1 = require("ethers");
|
|
8
|
-
const onchain_calls_1 = require("./onchain-calls");
|
|
9
|
-
const EmberVault_json_1 = __importDefault(require("../../abis/EmberVault.json"));
|
|
10
|
-
const EmberETHVault_json_1 = __importDefault(require("../../abis/EmberETHVault.json"));
|
|
1
|
+
import { Contract, ethers } from "ethers";
|
|
2
|
+
import { EVMOnChainCalls } from "./onchain-calls.js";
|
|
3
|
+
import EmberVaultABI from "../../abis/EmberVault.json" with { type: "json" };
|
|
4
|
+
import EmberETHVaultABI from "../../abis/EmberETHVault.json" with { type: "json" };
|
|
5
|
+
import { addressToBytes32 } from "../index.js";
|
|
11
6
|
/**
|
|
12
7
|
* User Calls for Ember Protocol on EVM (ERC-4626 Compatible)
|
|
13
8
|
*
|
|
@@ -54,7 +49,7 @@ const EmberETHVault_json_1 = __importDefault(require("../../abis/EmberETHVault.j
|
|
|
54
49
|
* await userCalls.redeemShares(vaultAddress, shares);
|
|
55
50
|
* ```
|
|
56
51
|
*/
|
|
57
|
-
class EVMUserCalls extends
|
|
52
|
+
export class EVMUserCalls extends EVMOnChainCalls {
|
|
58
53
|
constructor(_deployment, _signer, _provider, _walletAddress) {
|
|
59
54
|
super(_deployment, _signer, _provider, _walletAddress);
|
|
60
55
|
}
|
|
@@ -290,6 +285,58 @@ class EVMUserCalls extends onchain_calls_1.EVMOnChainCalls {
|
|
|
290
285
|
return this.approveToken(tokenAddress, spender, maxUint256, options);
|
|
291
286
|
}
|
|
292
287
|
// ============================================
|
|
288
|
+
// Bridge Methods
|
|
289
|
+
// ============================================
|
|
290
|
+
/**
|
|
291
|
+
* Bridges a receipt token to a destination chain using the configured OFT adapter.
|
|
292
|
+
*
|
|
293
|
+
* This method validates allowance, builds the LayerZero send parameters,
|
|
294
|
+
* and executes the adapter send transaction.
|
|
295
|
+
*
|
|
296
|
+
* @param destinationChain Destination chain metadata (must include lzChainId)
|
|
297
|
+
* @param tokenAddress Receipt token address (also used as vault identifier in EVM deployment data)
|
|
298
|
+
* @param amount Amount to bridge in local token decimals
|
|
299
|
+
* @param receiver Recipient wallet address on destination chain
|
|
300
|
+
* @param feeQuote Fee quote returned by reader.getOFTFeeQuote
|
|
301
|
+
* @param options Optional bridge/send overrides
|
|
302
|
+
* @returns Transaction execution response
|
|
303
|
+
*/
|
|
304
|
+
async bridgeSendToken(destinationChain, tokenAddress, amount, receiver, feeQuote, options) {
|
|
305
|
+
if (!this.provider) {
|
|
306
|
+
throw new Error("Provider required for bridge send read operations and allowance checks");
|
|
307
|
+
}
|
|
308
|
+
const adapter = this.parser.getOFTAdapterObjectByVaultId(tokenAddress);
|
|
309
|
+
if (!adapter?.address) {
|
|
310
|
+
throw new Error(`OFT adapter not found for token address: ${tokenAddress}`);
|
|
311
|
+
}
|
|
312
|
+
const refundAddress = options?.refundAddress ?? (await this.getWalletAddress());
|
|
313
|
+
if (destinationChain.lzChainId === undefined ||
|
|
314
|
+
destinationChain.lzChainId === null) {
|
|
315
|
+
throw new Error(`Destination chain "${destinationChain.name ?? destinationChain.identifier}" has no lzChainId — cannot construct sendParam.dstEid`);
|
|
316
|
+
}
|
|
317
|
+
const dstEid = destinationChain.lzChainId;
|
|
318
|
+
const amountBigInt = BigInt(amount);
|
|
319
|
+
const token = new ethers.Contract(tokenAddress, ["function allowance(address,address) view returns (uint256)"], this.provider);
|
|
320
|
+
const currentAllowance = await token.allowance(await this.getWalletAddress(), adapter.address);
|
|
321
|
+
if (currentAllowance < amountBigInt) {
|
|
322
|
+
throw new Error(`Insufficient allowance for bridge transfer. Current allowance: ${currentAllowance}, required: ${amountBigInt}`);
|
|
323
|
+
}
|
|
324
|
+
const sendParam = {
|
|
325
|
+
dstEid,
|
|
326
|
+
to: addressToBytes32(receiver),
|
|
327
|
+
amountLD: amountBigInt,
|
|
328
|
+
minAmountLD: options?.minAmount ?? amountBigInt,
|
|
329
|
+
extraOptions: options?.extraOptions,
|
|
330
|
+
composeMsg: options?.composeMsg,
|
|
331
|
+
oftCmd: options?.oftCmd
|
|
332
|
+
};
|
|
333
|
+
const txCall = this.txBuilder.bridgeSend(adapter.address, sendParam, {
|
|
334
|
+
nativeFee: feeQuote.nativeFee,
|
|
335
|
+
lzTokenFee: options?.payInLzToken ? feeQuote.lzTokenFee : 0n
|
|
336
|
+
}, refundAddress);
|
|
337
|
+
return this.execCall(txCall, options);
|
|
338
|
+
}
|
|
339
|
+
// ============================================
|
|
293
340
|
// Read-Only Methods
|
|
294
341
|
// ============================================
|
|
295
342
|
/**
|
|
@@ -301,8 +348,8 @@ class EVMUserCalls extends onchain_calls_1.EVMOnChainCalls {
|
|
|
301
348
|
if (!this.provider) {
|
|
302
349
|
throw new Error("Provider required for read operations");
|
|
303
350
|
}
|
|
304
|
-
const abi = isETHVault ?
|
|
305
|
-
return new
|
|
351
|
+
const abi = isETHVault ? EmberETHVaultABI.abi : EmberVaultABI.abi;
|
|
352
|
+
return new Contract(vaultAddress, abi, this.provider);
|
|
306
353
|
}
|
|
307
354
|
/**
|
|
308
355
|
* Gets an ERC20 contract instance for read operations
|
|
@@ -318,7 +365,7 @@ class EVMUserCalls extends onchain_calls_1.EVMOnChainCalls {
|
|
|
318
365
|
"function symbol() view returns (string)",
|
|
319
366
|
"function name() view returns (string)"
|
|
320
367
|
];
|
|
321
|
-
return new
|
|
368
|
+
return new Contract(tokenAddress, erc20Abi, this.provider);
|
|
322
369
|
}
|
|
323
370
|
/**
|
|
324
371
|
* Get the user's total vault shares (share token balance)
|
|
@@ -355,4 +402,3 @@ class EVMUserCalls extends onchain_calls_1.EVMOnChainCalls {
|
|
|
355
402
|
return token.allowance(ownerAddress, spender);
|
|
356
403
|
}
|
|
357
404
|
}
|
|
358
|
-
exports.EVMUserCalls = EVMUserCalls;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Signer, Provider } from "ethers";
|
|
2
|
-
import { EVMOnChainCalls } from "./onchain-calls";
|
|
3
|
-
import {
|
|
4
|
-
import { NumStr } from "../../common/types";
|
|
2
|
+
import { EVMOnChainCalls } from "./onchain-calls.js";
|
|
3
|
+
import { EvmProtocolInfo, IEvmCallOptions, EvmOnChainCallResponse, VaultPauseOperation } from "../interfaces/index.js";
|
|
4
|
+
import { NumStr } from "../../common/types.js";
|
|
5
5
|
/**
|
|
6
6
|
* Vault Admin Calls for Ember Protocol on EVM
|
|
7
7
|
*
|
|
@@ -35,7 +35,7 @@ import { NumStr } from "../../common/types";
|
|
|
35
35
|
* ```
|
|
36
36
|
*/
|
|
37
37
|
export declare class EVMVaultAdminCalls extends EVMOnChainCalls {
|
|
38
|
-
constructor(_deployment:
|
|
38
|
+
constructor(_deployment: EvmProtocolInfo, _signer?: Signer, _provider?: Provider, _walletAddress?: string);
|
|
39
39
|
/**
|
|
40
40
|
* Update the operator of a vault
|
|
41
41
|
* @param vaultAddress The address of the vault
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EVMVaultAdminCalls = void 0;
|
|
4
|
-
const onchain_calls_1 = require("./onchain-calls");
|
|
1
|
+
import { EVMOnChainCalls } from "./onchain-calls.js";
|
|
5
2
|
/**
|
|
6
3
|
* Vault Admin Calls for Ember Protocol on EVM
|
|
7
4
|
*
|
|
@@ -34,7 +31,7 @@ const onchain_calls_1 = require("./onchain-calls");
|
|
|
34
31
|
* await vaultAdminCalls.setVaultPausedStatus(vaultAddress, "deposits", true);
|
|
35
32
|
* ```
|
|
36
33
|
*/
|
|
37
|
-
class EVMVaultAdminCalls extends
|
|
34
|
+
export class EVMVaultAdminCalls extends EVMOnChainCalls {
|
|
38
35
|
constructor(_deployment, _signer, _provider, _walletAddress) {
|
|
39
36
|
super(_deployment, _signer, _provider, _walletAddress);
|
|
40
37
|
}
|
|
@@ -182,4 +179,3 @@ class EVMVaultAdminCalls extends onchain_calls_1.EVMOnChainCalls {
|
|
|
182
179
|
return this.execCall(txCall, options);
|
|
183
180
|
}
|
|
184
181
|
}
|
|
185
|
-
exports.EVMVaultAdminCalls = EVMVaultAdminCalls;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Provider } from "ethers";
|
|
2
|
-
import { EVMDeploymentParser } from "../utils/deployment-parser";
|
|
3
|
-
import {
|
|
4
|
-
import { NumStr } from "../../common/types";
|
|
2
|
+
import { EVMDeploymentParser } from "../utils/deployment-parser.js";
|
|
3
|
+
import { EvmProtocolInfo, IOFTSendParam, IOFTFeeQuote, IOFTVaultSupportedChain } from "../interfaces/index.js";
|
|
4
|
+
import { NumStr } from "../../common/types.js";
|
|
5
|
+
import { Chain, VaultsApi } from "../../api/v2/index.js";
|
|
5
6
|
/**
|
|
6
7
|
* Vault state returned by getVaultState
|
|
7
8
|
*/
|
|
@@ -164,12 +165,15 @@ export interface IUserPosition {
|
|
|
164
165
|
export declare class EVMVaultReader {
|
|
165
166
|
parser: EVMDeploymentParser;
|
|
166
167
|
provider: Provider;
|
|
167
|
-
|
|
168
|
+
vaultsApi: VaultsApi;
|
|
169
|
+
constructor(_deployment: EvmProtocolInfo, _provider: Provider, options?: {
|
|
170
|
+
apiBaseUrl: string;
|
|
171
|
+
});
|
|
168
172
|
/**
|
|
169
173
|
* Updates the deployment configuration
|
|
170
174
|
* @param newDeployment The new deployment configuration
|
|
171
175
|
*/
|
|
172
|
-
updateDeployment(newDeployment:
|
|
176
|
+
updateDeployment(newDeployment: EvmProtocolInfo): void;
|
|
173
177
|
/**
|
|
174
178
|
* Creates an ethers Contract instance for a vault
|
|
175
179
|
* @param vaultAddress The vault address
|
|
@@ -460,4 +464,34 @@ export declare class EVMVaultReader {
|
|
|
460
464
|
* @returns Array of complete vault info for all vaults
|
|
461
465
|
*/
|
|
462
466
|
getAllVaultsInfo(): Promise<ICompleteVaultInfo[]>;
|
|
467
|
+
getOFTAdapterAddressByVaultId(vaultId: string): string | null;
|
|
468
|
+
/**
|
|
469
|
+
* Creates an ethers Contract instance for an OFT adapter
|
|
470
|
+
*/
|
|
471
|
+
private getOFTAdapterContract;
|
|
472
|
+
/**
|
|
473
|
+
* Resolves and instantiates the OFT adapter contract for a vault identifier.
|
|
474
|
+
*
|
|
475
|
+
* @param vaultId Vault identifier (receipt token address on EVM)
|
|
476
|
+
* @returns OFT adapter contract instance, or null if no adapter is configured
|
|
477
|
+
*/
|
|
478
|
+
private getOFTAdapterByVaultId;
|
|
479
|
+
/**
|
|
480
|
+
* Returns the list of destination chains that an OFT adapter has peers configured for.
|
|
481
|
+
*
|
|
482
|
+
* @param vaultId The vault identifier (receipt token address on EVM)
|
|
483
|
+
* @returns Destination chains enriched with OFT adapter and peer metadata
|
|
484
|
+
*/
|
|
485
|
+
getOFTSupportedChains(vaultId: string, supportedChains?: Chain[]): Promise<IOFTVaultSupportedChain[]>;
|
|
486
|
+
/**
|
|
487
|
+
* Gets a fee quote for bridging tokens to another chain via LayerZero OFT.
|
|
488
|
+
* Combines both the messaging fee (quoteSend) and the OFT transfer details
|
|
489
|
+
* (quoteOFT) into a single result.
|
|
490
|
+
*
|
|
491
|
+
* @param vaultId The vault identifier used to resolve the OFT adapter
|
|
492
|
+
* @param sendParam The bridge send parameters
|
|
493
|
+
* @param payInLzToken Whether to pay the fee in the LZ token (default false = pay in native)
|
|
494
|
+
* @returns Combined fee quote including native fee and expected amounts
|
|
495
|
+
*/
|
|
496
|
+
getOFTFeeQuote(vaultId: string, sendParam: IOFTSendParam, payInLzToken?: boolean): Promise<IOFTFeeQuote>;
|
|
463
497
|
}
|