@mysten/deepbook-v3 2.0.0 → 2.1.3
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/CHANGELOG.md +100 -0
- package/PREDICT.md +256 -0
- package/README.md +116 -0
- package/dist/account.d.mts +139 -0
- package/dist/account.d.mts.map +1 -0
- package/dist/account.mjs +181 -0
- package/dist/account.mjs.map +1 -0
- package/dist/bcs/integers.mjs +23 -0
- package/dist/bcs/integers.mjs.map +1 -0
- package/dist/contracts/account/account.d.mts +382 -0
- package/dist/contracts/account/account.d.mts.map +1 -0
- package/dist/contracts/account/account.mjs +443 -0
- package/dist/contracts/account/account.mjs.map +1 -0
- package/dist/contracts/account/account_events.d.mts +41 -0
- package/dist/contracts/account/account_events.d.mts.map +1 -0
- package/dist/contracts/account/account_events.mjs +72 -0
- package/dist/contracts/account/account_events.mjs.map +1 -0
- package/dist/contracts/account/account_registry.d.mts +210 -0
- package/dist/contracts/account/account_registry.d.mts.map +1 -0
- package/dist/contracts/account/account_registry.mjs +263 -0
- package/dist/contracts/account/account_registry.mjs.map +1 -0
- package/dist/contracts/account/config-arguments.d.mts +10 -0
- package/dist/contracts/account/config-arguments.d.mts.map +1 -0
- package/dist/contracts/account/deps/sui/bag.mjs +44 -0
- package/dist/contracts/account/deps/sui/bag.mjs.map +1 -0
- package/dist/contracts/deepbook/account.d.mts +18 -18
- package/dist/contracts/deepbook/balance_manager.mjs.map +1 -1
- package/dist/contracts/deepbook/balances.d.mts +4 -4
- package/dist/contracts/deepbook/balances.d.mts.map +1 -1
- package/dist/contracts/deepbook/deep_price.d.mts +3 -3
- package/dist/contracts/deepbook/deep_price.d.mts.map +1 -1
- package/dist/contracts/deepbook/order.d.mts +12 -12
- package/dist/contracts/deepbook/pool.mjs.map +1 -1
- package/dist/contracts/deepbook/registry.mjs.map +1 -1
- package/dist/contracts/deepbook_margin/margin_manager.mjs.map +1 -1
- package/dist/contracts/deepbook_margin/margin_manager_upgraded.mjs.map +1 -1
- package/dist/contracts/deepbook_margin/margin_pool.mjs.map +1 -1
- package/dist/contracts/deepbook_margin/margin_registry.mjs.map +1 -1
- package/dist/contracts/deepbook_margin/pool_proxy.mjs.map +1 -1
- package/dist/contracts/deepbook_margin/protocol_config.mjs.map +1 -1
- package/dist/contracts/deepbook_margin/tpsl.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/builder_code_events.mjs +38 -0
- package/dist/contracts/deepbook_predict/builder_code_events.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/config-arguments.d.mts +13 -0
- package/dist/contracts/deepbook_predict/config-arguments.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict/deps/fixed_math/i64.mjs +25 -0
- package/dist/contracts/deepbook_predict/deps/fixed_math/i64.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/deps/sui/balance.mjs +25 -0
- package/dist/contracts/deepbook_predict/deps/sui/balance.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/deps/sui/coin.mjs +24 -0
- package/dist/contracts/deepbook_predict/deps/sui/coin.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/deps/sui/table.mjs +39 -0
- package/dist/contracts/deepbook_predict/deps/sui/table.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/deps/sui/vec_set.mjs +26 -0
- package/dist/contracts/deepbook_predict/deps/sui/vec_set.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/ewma.mjs +29 -0
- package/dist/contracts/deepbook_predict/ewma.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/expiry_cash.mjs +27 -0
- package/dist/contracts/deepbook_predict/expiry_cash.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/expiry_market.mjs +367 -0
- package/dist/contracts/deepbook_predict/expiry_market.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/lp_book.mjs +92 -0
- package/dist/contracts/deepbook_predict/lp_book.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/market_manager.mjs +59 -0
- package/dist/contracts/deepbook_predict/market_manager.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/order.mjs +26 -0
- package/dist/contracts/deepbook_predict/order.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/order_events.mjs +84 -0
- package/dist/contracts/deepbook_predict/order_events.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/plp.mjs +284 -0
- package/dist/contracts/deepbook_predict/plp.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/pool_accounting.mjs +58 -0
- package/dist/contracts/deepbook_predict/pool_accounting.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/predict_account.mjs +106 -0
- package/dist/contracts/deepbook_predict/predict_account.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/pricing.mjs +80 -0
- package/dist/contracts/deepbook_predict/pricing.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/range_codec.mjs +41 -0
- package/dist/contracts/deepbook_predict/range_codec.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/registry.mjs +55 -0
- package/dist/contracts/deepbook_predict/registry.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/strike_exposure.mjs +65 -0
- package/dist/contracts/deepbook_predict/strike_exposure.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/strike_exposure_config.mjs +33 -0
- package/dist/contracts/deepbook_predict/strike_exposure_config.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/strike_payout_tree.mjs +72 -0
- package/dist/contracts/deepbook_predict/strike_payout_tree.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/vault_events.mjs +184 -0
- package/dist/contracts/deepbook_predict/vault_events.mjs.map +1 -0
- package/dist/contracts/deepbook_sessions/config-arguments.d.mts +10 -0
- package/dist/contracts/deepbook_sessions/config-arguments.d.mts.map +1 -0
- package/dist/contracts/deepbook_sessions/deps/sui/vec_map.mjs +37 -0
- package/dist/contracts/deepbook_sessions/deps/sui/vec_map.mjs.map +1 -0
- package/dist/contracts/deepbook_sessions/session_config.d.mts +63 -0
- package/dist/contracts/deepbook_sessions/session_config.d.mts.map +1 -0
- package/dist/contracts/deepbook_sessions/session_config.mjs +82 -0
- package/dist/contracts/deepbook_sessions/session_config.mjs.map +1 -0
- package/dist/contracts/deepbook_sessions/sessions.d.mts +275 -0
- package/dist/contracts/deepbook_sessions/sessions.d.mts.map +1 -0
- package/dist/contracts/deepbook_sessions/sessions.mjs +443 -0
- package/dist/contracts/deepbook_sessions/sessions.mjs.map +1 -0
- package/dist/contracts/margin_liquidation/liquidation_vault.mjs.map +1 -1
- package/dist/contracts/utils/index.d.mts +18 -1
- package/dist/contracts/utils/index.d.mts.map +1 -1
- package/dist/deployments/index.d.mts +31 -0
- package/dist/deployments/index.d.mts.map +1 -0
- package/dist/deployments/index.mjs +30 -0
- package/dist/deployments/index.mjs.map +1 -0
- package/dist/deployments/testnet.d.mts +14 -0
- package/dist/deployments/testnet.d.mts.map +1 -0
- package/dist/deployments/testnet.mjs +73 -0
- package/dist/deployments/testnet.mjs.map +1 -0
- package/dist/deployments/types.d.mts +36 -0
- package/dist/deployments/types.d.mts.map +1 -0
- package/dist/index.mjs +0 -1
- package/dist/predict/client.d.mts +255 -0
- package/dist/predict/client.d.mts.map +1 -0
- package/dist/predict/client.mjs +436 -0
- package/dist/predict/client.mjs.map +1 -0
- package/dist/predict/config/generated.d.mts +29 -0
- package/dist/predict/config/generated.d.mts.map +1 -0
- package/dist/predict/config/generated.mjs +16 -0
- package/dist/predict/config/generated.mjs.map +1 -0
- package/dist/predict/config/index.d.mts +10 -0
- package/dist/predict/config/index.d.mts.map +1 -0
- package/dist/predict/config/index.mjs +13 -0
- package/dist/predict/config/index.mjs.map +1 -0
- package/dist/predict/config/testnet.d.mts +17 -0
- package/dist/predict/config/testnet.d.mts.map +1 -0
- package/dist/predict/config/testnet.mjs +26 -0
- package/dist/predict/config/testnet.mjs.map +1 -0
- package/dist/predict/config/types.d.mts +55 -0
- package/dist/predict/config/types.d.mts.map +1 -0
- package/dist/predict/decode.d.mts +162 -0
- package/dist/predict/decode.d.mts.map +1 -0
- package/dist/predict/decode.mjs +175 -0
- package/dist/predict/decode.mjs.map +1 -0
- package/dist/predict/errors.d.mts +42 -0
- package/dist/predict/errors.d.mts.map +1 -0
- package/dist/predict/errors.mjs +37 -0
- package/dist/predict/errors.mjs.map +1 -0
- package/dist/predict/index.d.mts +18 -0
- package/dist/predict/index.mjs +14 -0
- package/dist/predict/pricing.d.mts +73 -0
- package/dist/predict/pricing.d.mts.map +1 -0
- package/dist/predict/pricing.mjs +129 -0
- package/dist/predict/pricing.mjs.map +1 -0
- package/dist/predict/reads/balances.mjs +41 -0
- package/dist/predict/reads/balances.mjs.map +1 -0
- package/dist/predict/reads/inspect.d.mts +8 -0
- package/dist/predict/reads/inspect.d.mts.map +1 -0
- package/dist/predict/reads/inspect.mjs +37 -0
- package/dist/predict/reads/inspect.mjs.map +1 -0
- package/dist/predict/reads/markets.mjs +130 -0
- package/dist/predict/reads/markets.mjs.map +1 -0
- package/dist/predict/reads/parse.mjs +20 -0
- package/dist/predict/reads/parse.mjs.map +1 -0
- package/dist/predict/reads/pool.mjs +26 -0
- package/dist/predict/reads/pool.mjs.map +1 -0
- package/dist/predict/reads/positions.d.mts +12 -0
- package/dist/predict/reads/positions.d.mts.map +1 -0
- package/dist/predict/reads/positions.mjs +77 -0
- package/dist/predict/reads/positions.mjs.map +1 -0
- package/dist/predict/reads/pricing.d.mts +20 -0
- package/dist/predict/reads/pricing.d.mts.map +1 -0
- package/dist/predict/reads/pricing.mjs +43 -0
- package/dist/predict/reads/pricing.mjs.map +1 -0
- package/dist/predict/ticks.d.mts +11 -0
- package/dist/predict/ticks.d.mts.map +1 -0
- package/dist/predict/ticks.mjs +21 -0
- package/dist/predict/ticks.mjs.map +1 -0
- package/dist/predict/tx/authed.mjs +18 -0
- package/dist/predict/tx/authed.mjs.map +1 -0
- package/dist/predict/tx/common.d.mts +18 -0
- package/dist/predict/tx/common.d.mts.map +1 -0
- package/dist/predict/tx/common.mjs +52 -0
- package/dist/predict/tx/common.mjs.map +1 -0
- package/dist/predict/tx/trade.d.mts +15 -0
- package/dist/predict/tx/trade.d.mts.map +1 -0
- package/dist/predict/tx/trade.mjs +86 -0
- package/dist/predict/tx/trade.mjs.map +1 -0
- package/dist/predict/units.d.mts +11 -0
- package/dist/predict/units.d.mts.map +1 -0
- package/dist/predict/units.mjs +44 -0
- package/dist/predict/units.mjs.map +1 -0
- package/dist/queries/accountQueries.mjs +0 -1
- package/dist/queries/accountQueries.mjs.map +1 -1
- package/dist/queries/orderQueries.mjs +0 -1
- package/dist/queries/orderQueries.mjs.map +1 -1
- package/dist/queries/registryQueries.mjs +0 -1
- package/dist/queries/registryQueries.mjs.map +1 -1
- package/dist/sessions.d.mts +244 -0
- package/dist/sessions.d.mts.map +1 -0
- package/dist/sessions.mjs +291 -0
- package/dist/sessions.mjs.map +1 -0
- package/dist/transactions/balanceManager.d.mts +12 -12
- package/dist/transactions/deepbook.d.mts +20 -20
- package/dist/transactions/deepbookAdmin.d.mts +4 -4
- package/dist/transactions/deepbookAdmin.d.mts.map +1 -1
- package/dist/transactions/marginAdmin.d.mts +7 -7
- package/dist/transactions/marginLiquidations.d.mts +3 -3
- package/dist/transactions/marginMaintainer.d.mts +5 -5
- package/dist/transactions/marginManager.d.mts +32 -32
- package/dist/transactions/marginPool.d.mts +18 -18
- package/dist/transactions/marginRegistry.d.mts +16 -16
- package/dist/transactions/marginTPSL.d.mts +10 -10
- package/dist/transactions/poolProxy.d.mts +8 -8
- package/dist/types/index.d.mts.map +1 -1
- package/dist/types/index.mjs.map +1 -1
- package/dist/utils/constants.d.mts.map +1 -1
- package/dist/utils/constants.mjs +1 -1
- package/dist/utils/constants.mjs.map +1 -1
- package/package.json +33 -12
- package/src/account.ts +239 -0
- package/src/bcs/integers.ts +35 -0
- package/src/contracts/account/account.ts +706 -0
- package/src/contracts/account/account_events.ts +64 -0
- package/src/contracts/account/account_registry.ts +468 -0
- package/src/contracts/account/config-arguments.ts +8 -0
- package/src/contracts/account/deps/sui/bag.ts +42 -0
- package/src/contracts/deepbook/balance_manager.ts +1 -2
- package/src/contracts/deepbook/pool.ts +12 -24
- package/src/contracts/deepbook/registry.ts +1 -2
- package/src/contracts/deepbook_margin/margin_manager.ts +9 -18
- package/src/contracts/deepbook_margin/margin_manager_upgraded.ts +5 -10
- package/src/contracts/deepbook_margin/margin_pool.ts +2 -4
- package/src/contracts/deepbook_margin/margin_registry.ts +3 -6
- package/src/contracts/deepbook_margin/pool_proxy.ts +3 -6
- package/src/contracts/deepbook_margin/protocol_config.ts +1 -2
- package/src/contracts/deepbook_margin/tpsl.ts +1 -2
- package/src/contracts/deepbook_predict/admin.ts +44 -0
- package/src/contracts/deepbook_predict/builder_code.ts +155 -0
- package/src/contracts/deepbook_predict/builder_code_events.ts +34 -0
- package/src/contracts/deepbook_predict/config-arguments.ts +11 -0
- package/src/contracts/deepbook_predict/config_events.ts +140 -0
- package/src/contracts/deepbook_predict/deps/fixed_math/i64.ts +21 -0
- package/src/contracts/deepbook_predict/deps/sui/balance.ts +25 -0
- package/src/contracts/deepbook_predict/deps/sui/coin.ts +20 -0
- package/src/contracts/deepbook_predict/deps/sui/table.ts +37 -0
- package/src/contracts/deepbook_predict/deps/sui/vec_set.ts +22 -0
- package/src/contracts/deepbook_predict/ewma.ts +26 -0
- package/src/contracts/deepbook_predict/ewma_config.ts +28 -0
- package/src/contracts/deepbook_predict/expiry_cash.ts +24 -0
- package/src/contracts/deepbook_predict/expiry_market.ts +1549 -0
- package/src/contracts/deepbook_predict/lp_book.ts +105 -0
- package/src/contracts/deepbook_predict/market_lifecycle_cap.ts +75 -0
- package/src/contracts/deepbook_predict/market_manager.ts +218 -0
- package/src/contracts/deepbook_predict/order.ts +24 -0
- package/src/contracts/deepbook_predict/order_events.ts +129 -0
- package/src/contracts/deepbook_predict/pause_cap.ts +68 -0
- package/src/contracts/deepbook_predict/plp.ts +987 -0
- package/src/contracts/deepbook_predict/pool_accounting.ts +79 -0
- package/src/contracts/deepbook_predict/predict_account.ts +180 -0
- package/src/contracts/deepbook_predict/pricing.ts +124 -0
- package/src/contracts/deepbook_predict/pricing_config.ts +41 -0
- package/src/contracts/deepbook_predict/protocol_config.ts +1066 -0
- package/src/contracts/deepbook_predict/range_codec.ts +53 -0
- package/src/contracts/deepbook_predict/registry.ts +694 -0
- package/src/contracts/deepbook_predict/strike_exposure.ts +77 -0
- package/src/contracts/deepbook_predict/strike_exposure_config.ts +46 -0
- package/src/contracts/deepbook_predict/strike_payout_tree.ts +89 -0
- package/src/contracts/deepbook_predict/vault_events.ts +222 -0
- package/src/contracts/deepbook_sessions/config-arguments.ts +8 -0
- package/src/contracts/deepbook_sessions/deps/sui/vec_map.ts +33 -0
- package/src/contracts/deepbook_sessions/session_config.ts +130 -0
- package/src/contracts/deepbook_sessions/sessions.ts +663 -0
- package/src/contracts/margin_liquidation/liquidation_vault.ts +2 -4
- package/src/contracts/propbook/block_scholes_store.ts +842 -0
- package/src/contracts/propbook/deps/sui/table.ts +37 -0
- package/src/contracts/propbook/oracle_lane.ts +170 -0
- package/src/contracts/propbook/pyth_feed.ts +414 -0
- package/src/contracts/propbook/registry.ts +596 -0
- package/src/contracts/pyth/pyth.ts +2 -4
- package/src/deployments/index.ts +73 -0
- package/src/deployments/testnet.ts +107 -0
- package/src/deployments/types.ts +81 -0
- package/src/index.ts +5 -0
- package/src/predict/client.ts +941 -0
- package/src/predict/config/generated.ts +39 -0
- package/src/predict/config/index.ts +25 -0
- package/src/predict/config/testnet.ts +27 -0
- package/src/predict/config/types.ts +52 -0
- package/src/predict/decode.ts +476 -0
- package/src/predict/errors.ts +83 -0
- package/src/predict/index.ts +94 -0
- package/src/predict/pricing.ts +199 -0
- package/src/predict/reads/balances.ts +55 -0
- package/src/predict/reads/inspect.ts +78 -0
- package/src/predict/reads/markets.ts +222 -0
- package/src/predict/reads/parse.ts +30 -0
- package/src/predict/reads/pool.ts +37 -0
- package/src/predict/reads/positions.ts +144 -0
- package/src/predict/reads/pricing.ts +79 -0
- package/src/predict/ticks.ts +42 -0
- package/src/predict/tx/authed.ts +20 -0
- package/src/predict/tx/common.ts +92 -0
- package/src/predict/tx/trade.ts +183 -0
- package/src/predict/units.ts +49 -0
- package/src/sessions.ts +471 -0
- package/src/types/index.ts +1 -2
- package/src/utils/constants.ts +1 -7
- package/dist/types/bcs.mjs +0 -7
package/dist/account.mjs
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { Account, AccountWrapper, account_exports, balance, depositFunds, generateAuth, loadAccount, share, withdrawFunds } from "./contracts/account/account.mjs";
|
|
2
|
+
import { _new, account_registry_exports } from "./contracts/account/account_registry.mjs";
|
|
3
|
+
import { TESTNET_ACCOUNT, TESTNET_DEPLOYMENT, TESTNET_UNITS } from "./deployments/testnet.mjs";
|
|
4
|
+
import { getDeployment, getUnits } from "./deployments/index.mjs";
|
|
5
|
+
import { account_events_exports } from "./contracts/account/account_events.mjs";
|
|
6
|
+
import { bcs } from "@mysten/sui/bcs";
|
|
7
|
+
import { deriveObjectID } from "@mysten/sui/utils";
|
|
8
|
+
|
|
9
|
+
//#region src/account.ts
|
|
10
|
+
/**
|
|
11
|
+
* @description The deployed `account` ids for `network`, so a caller does not transcribe
|
|
12
|
+
* them. Generated from the deploy manifest — see `src/deployments/`.
|
|
13
|
+
* @throws if the network has no recorded deployment, rather than returning placeholder ids
|
|
14
|
+
* that would fail as a confusing on-chain abort.
|
|
15
|
+
*
|
|
16
|
+
* ```ts
|
|
17
|
+
* const account = new AccountContract(getAccountConfig('testnet'));
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
function getAccountConfig(network) {
|
|
21
|
+
if (network === "testnet") return TESTNET_ACCOUNT;
|
|
22
|
+
throw new Error(`@mysten/deepbook-v3/account: no account deployment recorded for network '${network}'. The account primitive is testnet-only today; for your own deployment pass \`{ accountPackageId, accountRegistry }\` to AccountContract directly.`);
|
|
23
|
+
}
|
|
24
|
+
const AccountWrapperKey = bcs.struct("AccountWrapperKey", { pos0: bcs.Address });
|
|
25
|
+
/**
|
|
26
|
+
* AccountContract — the reusable on-chain account primitive (`packages/account`).
|
|
27
|
+
*
|
|
28
|
+
* An owner has one canonical `AccountWrapper`, a *derived* object of the account registry,
|
|
29
|
+
* so its id is computable off-chain (no read). The wrapper holds an `Account` whose custody
|
|
30
|
+
* balances apps deposit into and withdraw from; app-specific data hangs off it under an
|
|
31
|
+
* app-keyed slot. Authority is a hot-potato `Auth` minted from the tx sender and consumed
|
|
32
|
+
* by the very next account-loading call.
|
|
33
|
+
*/
|
|
34
|
+
var AccountContract = class {
|
|
35
|
+
#config;
|
|
36
|
+
/**
|
|
37
|
+
* @param {AccountConfig} config Deployed ids of the shared `account` package
|
|
38
|
+
*/
|
|
39
|
+
constructor(config) {
|
|
40
|
+
this.#config = config;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* @description The deterministic id of an owner's canonical account wrapper — no chain
|
|
44
|
+
* read needed. The wrapper is a derived object of the account registry, so its id is
|
|
45
|
+
* `derive_address(registry, AccountWrapperKey(owner))`.
|
|
46
|
+
* @param {string} owner Owner address
|
|
47
|
+
* @returns The wrapper object id
|
|
48
|
+
*/
|
|
49
|
+
deriveAccountWrapperId(owner) {
|
|
50
|
+
const key = AccountWrapperKey.serialize({ pos0: owner }).toBytes();
|
|
51
|
+
return deriveObjectID(this.#config.accountRegistry, `${this.#config.accountPackageId}::account_registry::AccountWrapperKey`, key);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* @description Mint owner authority for the transaction sender. A hot-potato `Auth`
|
|
55
|
+
* consumed by the very next account-loading call (`load_account_mut` inside
|
|
56
|
+
* `deposit_funds` / `withdraw_funds` / an app's own entrypoints).
|
|
57
|
+
* @returns A function that takes a Transaction object
|
|
58
|
+
*/
|
|
59
|
+
generateAuth() {
|
|
60
|
+
return (tx) => tx.add(generateAuth({ config: this.#config }));
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* @description Create the sender's canonical account wrapper and share it. `new` derives
|
|
64
|
+
* the wrapper at its deterministic address (see `deriveAccountWrapperId`) and aborts if
|
|
65
|
+
* it already exists; `share` publishes the shared object apps borrow against.
|
|
66
|
+
* @returns A function that takes a Transaction object
|
|
67
|
+
*/
|
|
68
|
+
createAccount() {
|
|
69
|
+
return (tx) => {
|
|
70
|
+
const wrapper = tx.add(_new({ config: this.#config }));
|
|
71
|
+
tx.add(share({
|
|
72
|
+
config: this.#config,
|
|
73
|
+
arguments: { self: wrapper }
|
|
74
|
+
}));
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* @description First-time funding in ONE PTB: create the sender's wrapper, deposit
|
|
79
|
+
* `coin` through the fresh handle, then `share` LAST (once shared, by-value use of the
|
|
80
|
+
* handle is over). This cannot be split into `createAccount` + `depositFunds`: an object
|
|
81
|
+
* input can only address an object that pre-exists the PTB, so a wrapper created inside
|
|
82
|
+
* it is reachable only through `new`'s result handle.
|
|
83
|
+
* @param {object} params Coin to deposit and its coin type
|
|
84
|
+
* @returns A function that takes a Transaction object
|
|
85
|
+
*/
|
|
86
|
+
createAccountAndDeposit(params) {
|
|
87
|
+
return (tx) => {
|
|
88
|
+
const wrapper = tx.add(_new({ config: this.#config }));
|
|
89
|
+
const auth = tx.add(this.generateAuth());
|
|
90
|
+
tx.add(depositFunds({
|
|
91
|
+
config: this.#config,
|
|
92
|
+
arguments: {
|
|
93
|
+
wrapper,
|
|
94
|
+
auth,
|
|
95
|
+
coin: params.coin
|
|
96
|
+
},
|
|
97
|
+
typeArguments: [params.coinType]
|
|
98
|
+
}));
|
|
99
|
+
tx.add(share({
|
|
100
|
+
config: this.#config,
|
|
101
|
+
arguments: { self: wrapper }
|
|
102
|
+
}));
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* @description Deposit a caller-provided `coin` into the account's stored balance via the
|
|
107
|
+
* PTB-callable `deposit_funds` (folds settle → authorize → load → deposit; clock and
|
|
108
|
+
* accumulator root auto-injected). The caller owns coin sourcing.
|
|
109
|
+
* @param {object} params Wrapper id, coin to deposit, and its coin type
|
|
110
|
+
* @returns A function that takes a Transaction object
|
|
111
|
+
*/
|
|
112
|
+
depositFunds(params) {
|
|
113
|
+
return (tx) => {
|
|
114
|
+
const auth = tx.add(this.generateAuth());
|
|
115
|
+
tx.add(depositFunds({
|
|
116
|
+
config: this.#config,
|
|
117
|
+
arguments: {
|
|
118
|
+
wrapper: params.wrapperId,
|
|
119
|
+
auth,
|
|
120
|
+
coin: params.coin
|
|
121
|
+
},
|
|
122
|
+
typeArguments: [params.coinType]
|
|
123
|
+
}));
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* @description Withdraw `amount` (raw u64 units) from the account's stored balance via
|
|
128
|
+
* the PTB-callable `withdraw_funds` (folds settle → authorize → load → withdraw; clock
|
|
129
|
+
* and accumulator root auto-injected), returning the minted `Coin<T>` for the caller to
|
|
130
|
+
* transfer or compose.
|
|
131
|
+
* @param {object} params Wrapper id, raw amount, and coin type
|
|
132
|
+
* @returns A function that takes a Transaction object and returns the `Coin<T>`
|
|
133
|
+
*/
|
|
134
|
+
withdrawFunds(params) {
|
|
135
|
+
return (tx) => {
|
|
136
|
+
const auth = tx.add(this.generateAuth());
|
|
137
|
+
return tx.add(withdrawFunds({
|
|
138
|
+
config: this.#config,
|
|
139
|
+
arguments: {
|
|
140
|
+
wrapper: params.wrapperId,
|
|
141
|
+
auth,
|
|
142
|
+
amount: params.amount
|
|
143
|
+
},
|
|
144
|
+
typeArguments: [params.coinType]
|
|
145
|
+
}));
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* @description Borrow the `Account` out of its wrapper — the read-side entry point apps
|
|
150
|
+
* chain their own getters onto (`account::balance<T>`, an app's own data accessors).
|
|
151
|
+
* @param {object} params Wrapper id
|
|
152
|
+
* @returns A function that takes a Transaction object and returns the `Account`
|
|
153
|
+
*/
|
|
154
|
+
loadAccount(params) {
|
|
155
|
+
return (tx) => tx.add(loadAccount({
|
|
156
|
+
config: this.#config,
|
|
157
|
+
arguments: { self: params.wrapperId }
|
|
158
|
+
}));
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* @description Read an owner's stored custody balance for a coin type: chains
|
|
162
|
+
* `load_account(wrapper)` → `balance<T>(account, root, clock)`. Compose in a
|
|
163
|
+
* dev-inspect/simulate PTB and read the u64 return of the LAST command.
|
|
164
|
+
* @param {object} params Owner address and coin type
|
|
165
|
+
* @returns A function that takes a Transaction object
|
|
166
|
+
*/
|
|
167
|
+
balance(params) {
|
|
168
|
+
return (tx) => {
|
|
169
|
+
const acct = tx.add(this.loadAccount({ wrapperId: this.deriveAccountWrapperId(params.owner) }));
|
|
170
|
+
return tx.add(balance({
|
|
171
|
+
config: this.#config,
|
|
172
|
+
typeArguments: [params.coinType],
|
|
173
|
+
arguments: { self: acct }
|
|
174
|
+
}));
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
//#endregion
|
|
180
|
+
export { Account, AccountContract, AccountWrapper, TESTNET_DEPLOYMENT, TESTNET_UNITS, account_events_exports as accountEvents, account_exports as accountMoveCalls, account_registry_exports as accountRegistryMoveCalls, getAccountConfig, getDeployment, getUnits };
|
|
181
|
+
//# sourceMappingURL=account.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.mjs","names":["#config","account.generateAuth","accountRegistry._new","account.share","account.depositFunds","account.withdrawFunds","account.loadAccount","account.balance"],"sources":["../src/account.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\nimport { bcs } from '@mysten/sui/bcs';\nimport type {\n\tTransaction,\n\tTransactionObjectArgument,\n\tTransactionResult,\n} from '@mysten/sui/transactions';\nimport { deriveObjectID } from '@mysten/sui/utils';\n\nimport * as account from './contracts/account/account.js';\nimport * as accountRegistry from './contracts/account/account_registry.js';\nimport type { AccountConfig as GeneratedAccountConfig } from './contracts/account/config-arguments.js';\nimport { TESTNET_ACCOUNT } from './deployments/testnet.js';\nimport type { NetworkArg } from './deployments/index.js';\n\n// Provenance: which on-chain deployment the ids above came from. Re-exported so a consumer\n// can answer \"which deploy is this build pinned to?\" without reaching for another subpath.\nexport { getDeployment, getUnits, TESTNET_DEPLOYMENT, TESTNET_UNITS } from './deployments/index.js';\nexport type { NetworkArg } from './deployments/index.js';\nexport type { DeployedNetwork } from './deployments/index.js';\n\n/**\n * The deployed ids of the shared `account` package this contract builds against.\n *\n * Kept deliberately minimal — ids only — so any consumer of the shared account primitive\n * (DeepBook core's account wrapper, Predict, …) can drive these builders with its OWN\n * deployment's ids without constructing a full product-SDK config.\n *\n * Extends the codegen-generated config interface so there is exactly one config shape and\n * casing: the generated bindings resolve `options.config` against these same keys, and if\n * codegen adds, drops, or renames a key this file stops compiling instead of silently\n * building a PTB against the wrong object. The ids are narrowed to `string` — codegen types\n * the package id as optional and the registry as the wider `ConfigValue`, but the\n * wrapper-address derivation needs plain ids.\n */\nexport interface AccountConfig extends GeneratedAccountConfig {\n\t/** The `account` Move package id. */\n\taccountPackageId: string;\n\t/** The shared `AccountRegistry` object id. */\n\taccountRegistry: string;\n}\n\n/**\n * @description The deployed `account` ids for `network`, so a caller does not transcribe\n * them. Generated from the deploy manifest — see `src/deployments/`.\n * @throws if the network has no recorded deployment, rather than returning placeholder ids\n * that would fail as a confusing on-chain abort.\n *\n * ```ts\n * const account = new AccountContract(getAccountConfig('testnet'));\n * ```\n */\nexport function getAccountConfig(network: NetworkArg): AccountConfig {\n\tif (network === 'testnet') return TESTNET_ACCOUNT;\n\tthrow new Error(\n\t\t`@mysten/deepbook-v3/account: no account deployment recorded for network '${network}'. ` +\n\t\t\t'The account primitive is testnet-only today; for your own deployment pass ' +\n\t\t\t'`{ accountPackageId, accountRegistry }` to AccountContract directly.',\n\t);\n}\n\n// `AccountWrapperKey(address)` is a one-field positional struct, so its BCS is just the\n// owner's 32-byte address. See `packages/account/sources/account_registry.move`.\nconst AccountWrapperKey = bcs.struct('AccountWrapperKey', {\n\tpos0: bcs.Address,\n});\n\n/**\n * AccountContract — the reusable on-chain account primitive (`packages/account`).\n *\n * An owner has one canonical `AccountWrapper`, a *derived* object of the account registry,\n * so its id is computable off-chain (no read). The wrapper holds an `Account` whose custody\n * balances apps deposit into and withdraw from; app-specific data hangs off it under an\n * app-keyed slot. Authority is a hot-potato `Auth` minted from the tx sender and consumed\n * by the very next account-loading call.\n */\nexport class AccountContract {\n\t#config: AccountConfig;\n\n\t/**\n\t * @param {AccountConfig} config Deployed ids of the shared `account` package\n\t */\n\tconstructor(config: AccountConfig) {\n\t\tthis.#config = config;\n\t}\n\n\t/**\n\t * @description The deterministic id of an owner's canonical account wrapper — no chain\n\t * read needed. The wrapper is a derived object of the account registry, so its id is\n\t * `derive_address(registry, AccountWrapperKey(owner))`.\n\t * @param {string} owner Owner address\n\t * @returns The wrapper object id\n\t */\n\tderiveAccountWrapperId(owner: string): string {\n\t\tconst key = AccountWrapperKey.serialize({ pos0: owner }).toBytes();\n\t\treturn deriveObjectID(\n\t\t\tthis.#config.accountRegistry,\n\t\t\t`${this.#config.accountPackageId}::account_registry::AccountWrapperKey`,\n\t\t\tkey,\n\t\t);\n\t}\n\n\t/**\n\t * @description Mint owner authority for the transaction sender. A hot-potato `Auth`\n\t * consumed by the very next account-loading call (`load_account_mut` inside\n\t * `deposit_funds` / `withdraw_funds` / an app's own entrypoints).\n\t * @returns A function that takes a Transaction object\n\t */\n\tgenerateAuth() {\n\t\treturn (tx: Transaction): TransactionResult =>\n\t\t\ttx.add(account.generateAuth({ config: this.#config }));\n\t}\n\n\t/**\n\t * @description Create the sender's canonical account wrapper and share it. `new` derives\n\t * the wrapper at its deterministic address (see `deriveAccountWrapperId`) and aborts if\n\t * it already exists; `share` publishes the shared object apps borrow against.\n\t * @returns A function that takes a Transaction object\n\t */\n\tcreateAccount() {\n\t\treturn (tx: Transaction): void => {\n\t\t\tconst wrapper = tx.add(accountRegistry._new({ config: this.#config }));\n\t\t\ttx.add(account.share({ config: this.#config, arguments: { self: wrapper } }));\n\t\t};\n\t}\n\n\t/**\n\t * @description First-time funding in ONE PTB: create the sender's wrapper, deposit\n\t * `coin` through the fresh handle, then `share` LAST (once shared, by-value use of the\n\t * handle is over). This cannot be split into `createAccount` + `depositFunds`: an object\n\t * input can only address an object that pre-exists the PTB, so a wrapper created inside\n\t * it is reachable only through `new`'s result handle.\n\t * @param {object} params Coin to deposit and its coin type\n\t * @returns A function that takes a Transaction object\n\t */\n\tcreateAccountAndDeposit(params: { coin: TransactionObjectArgument; coinType: string }) {\n\t\treturn (tx: Transaction): void => {\n\t\t\tconst wrapper = tx.add(accountRegistry._new({ config: this.#config }));\n\t\t\tconst auth = tx.add(this.generateAuth());\n\t\t\ttx.add(\n\t\t\t\taccount.depositFunds({\n\t\t\t\t\tconfig: this.#config,\n\t\t\t\t\targuments: { wrapper, auth, coin: params.coin },\n\t\t\t\t\ttypeArguments: [params.coinType],\n\t\t\t\t}),\n\t\t\t);\n\t\t\ttx.add(account.share({ config: this.#config, arguments: { self: wrapper } }));\n\t\t};\n\t}\n\n\t/**\n\t * @description Deposit a caller-provided `coin` into the account's stored balance via the\n\t * PTB-callable `deposit_funds` (folds settle → authorize → load → deposit; clock and\n\t * accumulator root auto-injected). The caller owns coin sourcing.\n\t * @param {object} params Wrapper id, coin to deposit, and its coin type\n\t * @returns A function that takes a Transaction object\n\t */\n\tdepositFunds(params: { wrapperId: string; coin: TransactionObjectArgument; coinType: string }) {\n\t\treturn (tx: Transaction): void => {\n\t\t\tconst auth = tx.add(this.generateAuth());\n\t\t\ttx.add(\n\t\t\t\taccount.depositFunds({\n\t\t\t\t\tconfig: this.#config,\n\t\t\t\t\targuments: { wrapper: params.wrapperId, auth, coin: params.coin },\n\t\t\t\t\ttypeArguments: [params.coinType],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\t}\n\n\t/**\n\t * @description Withdraw `amount` (raw u64 units) from the account's stored balance via\n\t * the PTB-callable `withdraw_funds` (folds settle → authorize → load → withdraw; clock\n\t * and accumulator root auto-injected), returning the minted `Coin<T>` for the caller to\n\t * transfer or compose.\n\t * @param {object} params Wrapper id, raw amount, and coin type\n\t * @returns A function that takes a Transaction object and returns the `Coin<T>`\n\t */\n\twithdrawFunds(params: { wrapperId: string; amount: bigint; coinType: string }) {\n\t\treturn (tx: Transaction): TransactionResult => {\n\t\t\tconst auth = tx.add(this.generateAuth());\n\t\t\treturn tx.add(\n\t\t\t\taccount.withdrawFunds({\n\t\t\t\t\tconfig: this.#config,\n\t\t\t\t\targuments: { wrapper: params.wrapperId, auth, amount: params.amount },\n\t\t\t\t\ttypeArguments: [params.coinType],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\t}\n\n\t/**\n\t * @description Borrow the `Account` out of its wrapper — the read-side entry point apps\n\t * chain their own getters onto (`account::balance<T>`, an app's own data accessors).\n\t * @param {object} params Wrapper id\n\t * @returns A function that takes a Transaction object and returns the `Account`\n\t */\n\tloadAccount(params: { wrapperId: string }) {\n\t\treturn (tx: Transaction): TransactionResult =>\n\t\t\ttx.add(account.loadAccount({ config: this.#config, arguments: { self: params.wrapperId } }));\n\t}\n\n\t/**\n\t * @description Read an owner's stored custody balance for a coin type: chains\n\t * `load_account(wrapper)` → `balance<T>(account, root, clock)`. Compose in a\n\t * dev-inspect/simulate PTB and read the u64 return of the LAST command.\n\t * @param {object} params Owner address and coin type\n\t * @returns A function that takes a Transaction object\n\t */\n\tbalance(params: { owner: string; coinType: string }) {\n\t\treturn (tx: Transaction): TransactionResult => {\n\t\t\tconst acct = tx.add(\n\t\t\t\tthis.loadAccount({ wrapperId: this.deriveAccountWrapperId(params.owner) }),\n\t\t\t);\n\t\t\treturn tx.add(\n\t\t\t\taccount.balance({\n\t\t\t\t\tconfig: this.#config,\n\t\t\t\t\ttypeArguments: [params.coinType],\n\t\t\t\t\targuments: { self: acct },\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\t}\n}\n\n// === Generated bindings ===\n// The move-call thunks and BCS structs, for consumers composing their own PTBs or\n// parsing account objects/events (e.g. `AccountWrapper.parse`, the event layouts).\n//\n// NOTE: `Account` here is the shared account primitive's custody account\n// (`account::account::Account`). It is deliberately NOT re-exported from this\n// package's root — the root already exports a different `Account`\n// (`@deepbook/core::account::Account`, the per-pool trading account) and the two\n// have unrelated layouts. Keep them separated by subpath.\nexport * as accountMoveCalls from './contracts/account/account.js';\nexport * as accountRegistryMoveCalls from './contracts/account/account_registry.js';\nexport * as accountEvents from './contracts/account/account_events.js';\nexport { Account, AccountWrapper } from './contracts/account/account.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAqDA,SAAgB,iBAAiB,SAAoC;AACpE,KAAI,YAAY,UAAW,QAAO;AAClC,OAAM,IAAI,MACT,4EAA4E,QAAQ,qJAGpF;;AAKF,MAAM,oBAAoB,IAAI,OAAO,qBAAqB,EACzD,MAAM,IAAI,SACV,CAAC;;;;;;;;;;AAWF,IAAa,kBAAb,MAA6B;CAC5B;;;;CAKA,YAAY,QAAuB;AAClC,QAAKA,SAAU;;;;;;;;;CAUhB,uBAAuB,OAAuB;EAC7C,MAAM,MAAM,kBAAkB,UAAU,EAAE,MAAM,OAAO,CAAC,CAAC,SAAS;AAClE,SAAO,eACN,MAAKA,OAAQ,iBACb,GAAG,MAAKA,OAAQ,iBAAiB,wCACjC,IACA;;;;;;;;CASF,eAAe;AACd,UAAQ,OACP,GAAG,IAAIC,aAAqB,EAAE,QAAQ,MAAKD,QAAS,CAAC,CAAC;;;;;;;;CASxD,gBAAgB;AACf,UAAQ,OAA0B;GACjC,MAAM,UAAU,GAAG,IAAIE,KAAqB,EAAE,QAAQ,MAAKF,QAAS,CAAC,CAAC;AACtE,MAAG,IAAIG,MAAc;IAAE,QAAQ,MAAKH;IAAS,WAAW,EAAE,MAAM,SAAS;IAAE,CAAC,CAAC;;;;;;;;;;;;CAa/E,wBAAwB,QAA+D;AACt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AKP;IACb,eAAe,CAAC,OAAO,SAAS;IAChC,WAAW,EAAE,MAAM,MAAM;IACzB,CAAC,CACF"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { bcs } from "@mysten/sui/bcs";
|
|
2
|
+
|
|
3
|
+
//#region src/bcs/integers.ts
|
|
4
|
+
const toBigInt = (value) => BigInt(value);
|
|
5
|
+
/** `u64` parsed as a bigint rather than a decimal string. */
|
|
6
|
+
const U64 = bcs.u64().transform({
|
|
7
|
+
input: (value) => value.toString(),
|
|
8
|
+
output: toBigInt
|
|
9
|
+
});
|
|
10
|
+
/** `u128` parsed as a bigint rather than a decimal string. */
|
|
11
|
+
const U128 = bcs.u128().transform({
|
|
12
|
+
input: (value) => value.toString(),
|
|
13
|
+
output: toBigInt
|
|
14
|
+
});
|
|
15
|
+
/** `u256` parsed as a bigint rather than a decimal string. */
|
|
16
|
+
const U256 = bcs.u256().transform({
|
|
17
|
+
input: (value) => value.toString(),
|
|
18
|
+
output: toBigInt
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
export { U128, U256, U64 };
|
|
23
|
+
//# sourceMappingURL=integers.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integers.mjs","names":[],"sources":["../../src/bcs/integers.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\n// Replacement BCS integer types for the generated Move bindings (wired up in\n// `sui-codegen.config.ts` under `bcsOverrides`).\n//\n// `@mysten/sui/bcs` parses the wide integers to decimal *strings*; these parse straight to bigint\n// instead. Serialization still accepts what the plain types accept, so tx builders and test\n// fixtures are unaffected.\n//\n// Representation only — deliberately no scaling. A field's Move type does not determine its\n// scale (custody balances are raw coin units while an app's own fields may be rates), and the\n// exact on-chain integers are what consumers decoding account state and events want.\n\nimport { bcs } from '@mysten/sui/bcs';\n\nconst toBigInt = (value: string) => BigInt(value);\n\n/** `u64` parsed as a bigint rather than a decimal string. */\nexport const U64 = bcs.u64().transform({\n\tinput: (value: number | bigint | string) => value.toString(),\n\toutput: toBigInt,\n});\n\n/** `u128` parsed as a bigint rather than a decimal string. */\nexport const U128 = bcs.u128().transform({\n\tinput: (value: number | bigint | string) => value.toString(),\n\toutput: toBigInt,\n});\n\n/** `u256` parsed as a bigint rather than a decimal string. */\nexport const U256 = bcs.u256().transform({\n\tinput: (value: number | bigint | string) => value.toString(),\n\toutput: toBigInt,\n});\n"],"mappings":";;;AAgBA,MAAM,YAAY,UAAkB,OAAO,MAAM;;AAGjD,MAAa,MAAM,IAAI,KAAK,CAAC,UAAU;CACtC,QAAQ,UAAoC,MAAM,UAAU;CAC5D,QAAQ;CACR,CAAC;;AAGF,MAAa,OAAO,IAAI,MAAM,CAAC,UAAU;CACxC,QAAQ,UAAoC,MAAM,UAAU;CAC5D,QAAQ;CACR,CAAC;;AAGF,MAAa,OAAO,IAAI,MAAM,CAAC,UAAU;CACxC,QAAQ,UAAoC,MAAM,UAAU;CAC5D,QAAQ;CACR,CAAC"}
|
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
import { MoveStruct, MoveTuple, RawTransactionArgument } from "../utils/index.mjs";
|
|
2
|
+
import { BcsType } from "@mysten/sui/bcs";
|
|
3
|
+
import * as _mysten_sui_transactions118 from "@mysten/sui/transactions";
|
|
4
|
+
import { Transaction, TransactionArgument } from "@mysten/sui/transactions";
|
|
5
|
+
|
|
6
|
+
//#region src/contracts/account/account.d.ts
|
|
7
|
+
declare namespace account_d_exports {
|
|
8
|
+
export { Account, AccountIdArguments, AccountIdOptions, AccountWrapper, AttachArguments, AttachOptions, Auth, BalanceArguments, BalanceOptions, BorrowDataArguments, BorrowDataMutArguments, BorrowDataMutOptions, BorrowDataOptions, CoinKey, DataKey, DepositArguments, DepositFundsArguments, DepositFundsOptions, DepositOptions, DetachArguments, DetachOptions, GenerateAuthAsObjectArguments, GenerateAuthAsObjectOptions, GenerateAuthOptions, HasDataArguments, HasDataOptions, IdArguments, IdOptions, LoadAccountArguments, LoadAccountMutArguments, LoadAccountMutOptions, LoadAccountOptions, OwnerArguments, OwnerOptions, ReceiveAddressArguments, ReceiveAddressOptions, ReferrerAccountIdArguments, ReferrerAccountIdOptions, ReferrerReceiveAddressArguments, ReferrerReceiveAddressOptions, SettleArguments, SettleOptions, ShareArguments, ShareOptions, WithdrawArguments, WithdrawFundsArguments, WithdrawFundsOptions, WithdrawOptions, accountId, attach, balance, borrowData, borrowDataMut, deposit, depositFunds, detach, generateAuth, generateAuthAsObject, hasData, id, loadAccount, loadAccountMut, owner, receiveAddress, referrerAccountId, referrerReceiveAddress, settle, share, withdraw, withdrawFunds };
|
|
9
|
+
}
|
|
10
|
+
declare const Account: MoveStruct<{
|
|
11
|
+
/** Dynamic-field parent for account-owned application data. */account_id: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">; /** EOA address or object-ID-as-address that owns this account. */
|
|
12
|
+
owner: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">; /** Wrapper-object address used as the accumulator delivery and withdrawal anchor. */
|
|
13
|
+
receive_address: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">; /** Type-indexed stored `Balance<T>` values. */
|
|
14
|
+
balances: MoveStruct<{
|
|
15
|
+
id: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
16
|
+
size: BcsType<bigint, string | number | bigint, "u64">;
|
|
17
|
+
}, "0x2::bag::Bag">; /** Type-indexed timestamps of the latest settlement attempt. */
|
|
18
|
+
settlements: MoveStruct<{
|
|
19
|
+
id: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
20
|
+
size: BcsType<bigint, string | number | bigint, "u64">;
|
|
21
|
+
}, "0x2::bag::Bag">; /** Canonical account ID supplied at referral-based creation, if any. */
|
|
22
|
+
referrer_account_id: BcsType<string | null, string | Uint8Array<ArrayBufferLike> | null | undefined, "Option<bytes[32]>">; /** Referrer's wrapper address for accumulator delivery, if any. */
|
|
23
|
+
referrer_receive_address: BcsType<string | null, string | Uint8Array<ArrayBufferLike> | null | undefined, "Option<bytes[32]>">;
|
|
24
|
+
}, "@local-pkg/account::account::Account">;
|
|
25
|
+
declare const AccountWrapper: MoveStruct<{
|
|
26
|
+
id: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
27
|
+
account: MoveStruct<{
|
|
28
|
+
/** Dynamic-field parent for account-owned application data. */account_id: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">; /** EOA address or object-ID-as-address that owns this account. */
|
|
29
|
+
owner: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">; /** Wrapper-object address used as the accumulator delivery and withdrawal anchor. */
|
|
30
|
+
receive_address: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">; /** Type-indexed stored `Balance<T>` values. */
|
|
31
|
+
balances: MoveStruct<{
|
|
32
|
+
id: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
33
|
+
size: BcsType<bigint, string | number | bigint, "u64">;
|
|
34
|
+
}, "0x2::bag::Bag">; /** Type-indexed timestamps of the latest settlement attempt. */
|
|
35
|
+
settlements: MoveStruct<{
|
|
36
|
+
id: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
37
|
+
size: BcsType<bigint, string | number | bigint, "u64">;
|
|
38
|
+
}, "0x2::bag::Bag">; /** Canonical account ID supplied at referral-based creation, if any. */
|
|
39
|
+
referrer_account_id: BcsType<string | null, string | Uint8Array<ArrayBufferLike> | null | undefined, "Option<bytes[32]>">; /** Referrer's wrapper address for accumulator delivery, if any. */
|
|
40
|
+
referrer_receive_address: BcsType<string | null, string | Uint8Array<ArrayBufferLike> | null | undefined, "Option<bytes[32]>">;
|
|
41
|
+
}, "@local-pkg/account::account::Account">;
|
|
42
|
+
}, "@local-pkg/account::account::AccountWrapper">;
|
|
43
|
+
declare const DataKey: MoveTuple<readonly [BcsType<boolean, boolean, "bool">], "@local-pkg/account::account::DataKey<phantom App>">;
|
|
44
|
+
declare const CoinKey: MoveTuple<readonly [BcsType<boolean, boolean, "bool">], "@local-pkg/account::account::CoinKey<phantom T>">;
|
|
45
|
+
declare const Auth: MoveStruct<{
|
|
46
|
+
kind: BcsType<number, number, "u8">;
|
|
47
|
+
owner: BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
48
|
+
}, "@local-pkg/account::account::Auth">;
|
|
49
|
+
interface IdArguments {
|
|
50
|
+
self: RawTransactionArgument<string>;
|
|
51
|
+
}
|
|
52
|
+
interface IdOptions {
|
|
53
|
+
package?: string;
|
|
54
|
+
arguments: IdArguments | [self: RawTransactionArgument<string>];
|
|
55
|
+
config?: {
|
|
56
|
+
accountPackageId?: string;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
/** Returns the wrapper object ID. */
|
|
60
|
+
declare function id(options: IdOptions): (tx: Transaction) => _mysten_sui_transactions118.TransactionResult;
|
|
61
|
+
interface LoadAccountArguments {
|
|
62
|
+
self: RawTransactionArgument<string>;
|
|
63
|
+
}
|
|
64
|
+
interface LoadAccountOptions {
|
|
65
|
+
package?: string;
|
|
66
|
+
arguments: LoadAccountArguments | [self: RawTransactionArgument<string>];
|
|
67
|
+
config?: {
|
|
68
|
+
accountPackageId?: string;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/** Borrows the wrapped account for read-only composition. */
|
|
72
|
+
declare function loadAccount(options: LoadAccountOptions): (tx: Transaction) => _mysten_sui_transactions118.TransactionResult;
|
|
73
|
+
interface BalanceArguments {
|
|
74
|
+
self: TransactionArgument;
|
|
75
|
+
}
|
|
76
|
+
interface BalanceOptions {
|
|
77
|
+
package?: string;
|
|
78
|
+
arguments: BalanceArguments | [self: TransactionArgument];
|
|
79
|
+
config?: {
|
|
80
|
+
accountPackageId?: string;
|
|
81
|
+
};
|
|
82
|
+
typeArguments: [string];
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Returns the total balance of `T` available to the account, including funds
|
|
86
|
+
* delivered through the ambient accumulator but not yet settled into the account.
|
|
87
|
+
*/
|
|
88
|
+
declare function balance(options: BalanceOptions): (tx: Transaction) => _mysten_sui_transactions118.TransactionResult;
|
|
89
|
+
interface OwnerArguments {
|
|
90
|
+
self: TransactionArgument;
|
|
91
|
+
}
|
|
92
|
+
interface OwnerOptions {
|
|
93
|
+
package?: string;
|
|
94
|
+
arguments: OwnerArguments | [self: TransactionArgument];
|
|
95
|
+
config?: {
|
|
96
|
+
accountPackageId?: string;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Returns the account owner address. This may be an EOA address or an
|
|
101
|
+
* object-ID-as-address.
|
|
102
|
+
*/
|
|
103
|
+
declare function owner(options: OwnerOptions): (tx: Transaction) => _mysten_sui_transactions118.TransactionResult;
|
|
104
|
+
interface AccountIdArguments {
|
|
105
|
+
self: TransactionArgument;
|
|
106
|
+
}
|
|
107
|
+
interface AccountIdOptions {
|
|
108
|
+
package?: string;
|
|
109
|
+
arguments: AccountIdArguments | [self: TransactionArgument];
|
|
110
|
+
config?: {
|
|
111
|
+
accountPackageId?: string;
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
/** Returns the canonical account ID. */
|
|
115
|
+
declare function accountId(options: AccountIdOptions): (tx: Transaction) => _mysten_sui_transactions118.TransactionResult;
|
|
116
|
+
interface ReferrerAccountIdArguments {
|
|
117
|
+
self: TransactionArgument;
|
|
118
|
+
}
|
|
119
|
+
interface ReferrerAccountIdOptions {
|
|
120
|
+
package?: string;
|
|
121
|
+
arguments: ReferrerAccountIdArguments | [self: TransactionArgument];
|
|
122
|
+
config?: {
|
|
123
|
+
accountPackageId?: string;
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Returns the canonical referrer account ID recorded at creation for external Move
|
|
128
|
+
* composition.
|
|
129
|
+
*/
|
|
130
|
+
declare function referrerAccountId(options: ReferrerAccountIdOptions): (tx: Transaction) => _mysten_sui_transactions118.TransactionResult;
|
|
131
|
+
interface ReferrerReceiveAddressArguments {
|
|
132
|
+
self: TransactionArgument;
|
|
133
|
+
}
|
|
134
|
+
interface ReferrerReceiveAddressOptions {
|
|
135
|
+
package?: string;
|
|
136
|
+
arguments: ReferrerReceiveAddressArguments | [self: TransactionArgument];
|
|
137
|
+
config?: {
|
|
138
|
+
accountPackageId?: string;
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Returns the referrer's accumulator receive address for external Move
|
|
143
|
+
* composition.
|
|
144
|
+
*/
|
|
145
|
+
declare function referrerReceiveAddress(options: ReferrerReceiveAddressOptions): (tx: Transaction) => _mysten_sui_transactions118.TransactionResult;
|
|
146
|
+
interface ReceiveAddressArguments {
|
|
147
|
+
self: TransactionArgument;
|
|
148
|
+
}
|
|
149
|
+
interface ReceiveAddressOptions {
|
|
150
|
+
package?: string;
|
|
151
|
+
arguments: ReceiveAddressArguments | [self: TransactionArgument];
|
|
152
|
+
config?: {
|
|
153
|
+
accountPackageId?: string;
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
/** Returns the accumulator receive address for this account (the wrapper address). */
|
|
157
|
+
declare function receiveAddress(options: ReceiveAddressOptions): (tx: Transaction) => _mysten_sui_transactions118.TransactionResult;
|
|
158
|
+
interface GenerateAuthOptions {
|
|
159
|
+
package?: string;
|
|
160
|
+
arguments?: [];
|
|
161
|
+
config?: {
|
|
162
|
+
accountPackageId?: string;
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
/** Creates owner authority bound to the transaction sender. */
|
|
166
|
+
declare function generateAuth(options?: GenerateAuthOptions): (tx: Transaction) => _mysten_sui_transactions118.TransactionResult;
|
|
167
|
+
interface GenerateAuthAsObjectArguments {
|
|
168
|
+
uid: RawTransactionArgument<string>;
|
|
169
|
+
}
|
|
170
|
+
interface GenerateAuthAsObjectOptions {
|
|
171
|
+
package?: string;
|
|
172
|
+
arguments: GenerateAuthAsObjectArguments | [uid: RawTransactionArgument<string>];
|
|
173
|
+
config?: {
|
|
174
|
+
accountPackageId?: string;
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
/** Creates owner authority bound to an owning object's address. */
|
|
178
|
+
declare function generateAuthAsObject(options: GenerateAuthAsObjectOptions): (tx: Transaction) => _mysten_sui_transactions118.TransactionResult;
|
|
179
|
+
interface ShareArguments {
|
|
180
|
+
self: RawTransactionArgument<string>;
|
|
181
|
+
}
|
|
182
|
+
interface ShareOptions {
|
|
183
|
+
package?: string;
|
|
184
|
+
arguments: ShareArguments | [self: RawTransactionArgument<string>];
|
|
185
|
+
config?: {
|
|
186
|
+
accountPackageId?: string;
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
/** Shares a newly created account wrapper. */
|
|
190
|
+
declare function share(options: ShareOptions): (tx: Transaction) => _mysten_sui_transactions118.TransactionResult;
|
|
191
|
+
interface LoadAccountMutArguments {
|
|
192
|
+
self: RawTransactionArgument<string>;
|
|
193
|
+
auth: TransactionArgument;
|
|
194
|
+
}
|
|
195
|
+
interface LoadAccountMutOptions {
|
|
196
|
+
package?: string;
|
|
197
|
+
arguments: LoadAccountMutArguments | [self: RawTransactionArgument<string>, auth: TransactionArgument];
|
|
198
|
+
config?: {
|
|
199
|
+
accountPackageId?: string;
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Consumes owner or app authority and returns the account's full mutable surface.
|
|
204
|
+
* Owner authority must match the stored owner; app authority is package-issued
|
|
205
|
+
* after registry authorization and carries no owner or operation restriction.
|
|
206
|
+
*/
|
|
207
|
+
declare function loadAccountMut(options: LoadAccountMutOptions): (tx: Transaction) => _mysten_sui_transactions118.TransactionResult;
|
|
208
|
+
interface SettleArguments {
|
|
209
|
+
wrapper: RawTransactionArgument<string>;
|
|
210
|
+
}
|
|
211
|
+
interface SettleOptions {
|
|
212
|
+
package?: string;
|
|
213
|
+
arguments: SettleArguments | [wrapper: RawTransactionArgument<string>];
|
|
214
|
+
config?: {
|
|
215
|
+
accountPackageId?: string;
|
|
216
|
+
};
|
|
217
|
+
typeArguments: [string];
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Permissionlessly folds accumulator-delivered `T` at the wrapper address into
|
|
221
|
+
* stored account balance. The per-coin timestamp is latched before reading the
|
|
222
|
+
* accumulator, preventing duplicate withdrawal and same-timestamp double counting
|
|
223
|
+
* even when no funds are available. Only the wrapper UID can authenticate the
|
|
224
|
+
* address-balance withdrawal; value leaving the account still requires a mutable
|
|
225
|
+
* borrow through `Auth`.
|
|
226
|
+
*/
|
|
227
|
+
declare function settle(options: SettleOptions): (tx: Transaction) => _mysten_sui_transactions118.TransactionResult;
|
|
228
|
+
interface DepositArguments {
|
|
229
|
+
self: TransactionArgument;
|
|
230
|
+
coin: RawTransactionArgument<string>;
|
|
231
|
+
}
|
|
232
|
+
interface DepositOptions {
|
|
233
|
+
package?: string;
|
|
234
|
+
arguments: DepositArguments | [self: TransactionArgument, coin: RawTransactionArgument<string>];
|
|
235
|
+
config?: {
|
|
236
|
+
accountPackageId?: string;
|
|
237
|
+
};
|
|
238
|
+
typeArguments: [string];
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Deposits into stored balance only; callers that include accumulator funds must
|
|
242
|
+
* settle through the wrapper first.
|
|
243
|
+
*/
|
|
244
|
+
declare function deposit(options: DepositOptions): (tx: Transaction) => _mysten_sui_transactions118.TransactionResult;
|
|
245
|
+
interface WithdrawArguments {
|
|
246
|
+
self: TransactionArgument;
|
|
247
|
+
amount: RawTransactionArgument<number | bigint>;
|
|
248
|
+
}
|
|
249
|
+
interface WithdrawOptions {
|
|
250
|
+
package?: string;
|
|
251
|
+
arguments: WithdrawArguments | [self: TransactionArgument, amount: RawTransactionArgument<number | bigint>];
|
|
252
|
+
config?: {
|
|
253
|
+
accountPackageId?: string;
|
|
254
|
+
};
|
|
255
|
+
typeArguments: [string];
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Withdraws from stored balance only; callers that include accumulator funds must
|
|
259
|
+
* settle through the wrapper first.
|
|
260
|
+
*/
|
|
261
|
+
declare function withdraw(options: WithdrawOptions): (tx: Transaction) => _mysten_sui_transactions118.TransactionResult;
|
|
262
|
+
interface DepositFundsArguments {
|
|
263
|
+
wrapper: RawTransactionArgument<string>;
|
|
264
|
+
auth: TransactionArgument;
|
|
265
|
+
coin: RawTransactionArgument<string>;
|
|
266
|
+
}
|
|
267
|
+
interface DepositFundsOptions {
|
|
268
|
+
package?: string;
|
|
269
|
+
arguments: DepositFundsArguments | [wrapper: RawTransactionArgument<string>, auth: TransactionArgument, coin: RawTransactionArgument<string>];
|
|
270
|
+
config?: {
|
|
271
|
+
accountPackageId?: string;
|
|
272
|
+
};
|
|
273
|
+
typeArguments: [string];
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* PTB entrypoint that settles accumulator funds, consumes authority, and deposits
|
|
277
|
+
* into stored balance in one call.
|
|
278
|
+
*/
|
|
279
|
+
declare function depositFunds(options: DepositFundsOptions): (tx: Transaction) => _mysten_sui_transactions118.TransactionResult;
|
|
280
|
+
interface WithdrawFundsArguments {
|
|
281
|
+
wrapper: RawTransactionArgument<string>;
|
|
282
|
+
auth: TransactionArgument;
|
|
283
|
+
amount: RawTransactionArgument<number | bigint>;
|
|
284
|
+
}
|
|
285
|
+
interface WithdrawFundsOptions {
|
|
286
|
+
package?: string;
|
|
287
|
+
arguments: WithdrawFundsArguments | [wrapper: RawTransactionArgument<string>, auth: TransactionArgument, amount: RawTransactionArgument<number | bigint>];
|
|
288
|
+
config?: {
|
|
289
|
+
accountPackageId?: string;
|
|
290
|
+
};
|
|
291
|
+
typeArguments: [string];
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* PTB entrypoint that settles accumulator funds, consumes authority, and withdraws
|
|
295
|
+
* from stored balance in one call.
|
|
296
|
+
*/
|
|
297
|
+
declare function withdrawFunds(options: WithdrawFundsOptions): (tx: Transaction) => _mysten_sui_transactions118.TransactionResult;
|
|
298
|
+
interface AttachArguments<Data extends BcsType<any>> {
|
|
299
|
+
self: TransactionArgument;
|
|
300
|
+
Permit: TransactionArgument;
|
|
301
|
+
data: RawTransactionArgument<Data>;
|
|
302
|
+
}
|
|
303
|
+
interface AttachOptions<Data extends BcsType<any>> {
|
|
304
|
+
package?: string;
|
|
305
|
+
arguments: AttachArguments<Data> | [self: TransactionArgument, Permit: TransactionArgument, data: RawTransactionArgument<Data>];
|
|
306
|
+
config?: {
|
|
307
|
+
accountPackageId?: string;
|
|
308
|
+
};
|
|
309
|
+
typeArguments: [string, string];
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Attach an app's `Data` under its witness namespace. Requires `Permit<App>`.
|
|
313
|
+
* Aborts if `App` already has data attached.
|
|
314
|
+
*/
|
|
315
|
+
declare function attach<Data extends BcsType<any>>(options: AttachOptions<Data>): (tx: Transaction) => _mysten_sui_transactions118.TransactionResult;
|
|
316
|
+
interface HasDataArguments {
|
|
317
|
+
self: TransactionArgument;
|
|
318
|
+
}
|
|
319
|
+
interface HasDataOptions {
|
|
320
|
+
package?: string;
|
|
321
|
+
arguments: HasDataArguments | [self: TransactionArgument];
|
|
322
|
+
config?: {
|
|
323
|
+
accountPackageId?: string;
|
|
324
|
+
};
|
|
325
|
+
typeArguments: [string];
|
|
326
|
+
}
|
|
327
|
+
/** Whether `App` has data attached to this account. */
|
|
328
|
+
declare function hasData(options: HasDataOptions): (tx: Transaction) => _mysten_sui_transactions118.TransactionResult;
|
|
329
|
+
interface BorrowDataArguments {
|
|
330
|
+
self: TransactionArgument;
|
|
331
|
+
}
|
|
332
|
+
interface BorrowDataOptions {
|
|
333
|
+
package?: string;
|
|
334
|
+
arguments: BorrowDataArguments | [self: TransactionArgument];
|
|
335
|
+
config?: {
|
|
336
|
+
accountPackageId?: string;
|
|
337
|
+
};
|
|
338
|
+
typeArguments: [string, string];
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Borrow an app's attached `Data`. Open (no witness): the slot is namespaced by
|
|
342
|
+
* `App` and on-chain state is public, so composing apps can read it. Aborts if
|
|
343
|
+
* nothing is attached.
|
|
344
|
+
*/
|
|
345
|
+
declare function borrowData(options: BorrowDataOptions): (tx: Transaction) => _mysten_sui_transactions118.TransactionResult;
|
|
346
|
+
interface BorrowDataMutArguments {
|
|
347
|
+
self: TransactionArgument;
|
|
348
|
+
Permit: TransactionArgument;
|
|
349
|
+
}
|
|
350
|
+
interface BorrowDataMutOptions {
|
|
351
|
+
package?: string;
|
|
352
|
+
arguments: BorrowDataMutArguments | [self: TransactionArgument, Permit: TransactionArgument];
|
|
353
|
+
config?: {
|
|
354
|
+
accountPackageId?: string;
|
|
355
|
+
};
|
|
356
|
+
typeArguments: [string, string];
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Mutably borrow an app's attached `Data`. Requires `Permit<App>`. Aborts if
|
|
360
|
+
* nothing is attached.
|
|
361
|
+
*/
|
|
362
|
+
declare function borrowDataMut(options: BorrowDataMutOptions): (tx: Transaction) => _mysten_sui_transactions118.TransactionResult;
|
|
363
|
+
interface DetachArguments {
|
|
364
|
+
self: TransactionArgument;
|
|
365
|
+
Permit: TransactionArgument;
|
|
366
|
+
}
|
|
367
|
+
interface DetachOptions {
|
|
368
|
+
package?: string;
|
|
369
|
+
arguments: DetachArguments | [self: TransactionArgument, Permit: TransactionArgument];
|
|
370
|
+
config?: {
|
|
371
|
+
accountPackageId?: string;
|
|
372
|
+
};
|
|
373
|
+
typeArguments: [string, string];
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Detach and return an app's `Data`. Requires `Permit<App>`. Aborts if nothing is
|
|
377
|
+
* attached.
|
|
378
|
+
*/
|
|
379
|
+
declare function detach(options: DetachOptions): (tx: Transaction) => _mysten_sui_transactions118.TransactionResult;
|
|
380
|
+
//#endregion
|
|
381
|
+
export { Account, AccountWrapper, account_d_exports };
|
|
382
|
+
//# sourceMappingURL=account.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.d.mts","names":[],"sources":["../../../src/contracts/account/account.ts"],"mappings":";;;;;;;;;cAyBa,OAAA,EAAO,UAAA;;;;;;;;;;;;;;;cAmBP,cAAA,EAAc,UAAA;;;;;;;;;;;;;;;;;;cAOd,OAAA,EAAO,SAAA,WAAA,OAAA;AAAA,cAIP,OAAA,EAAO,SAAA,WAAA,OAAA;AAAA,cAIP,IAAA,EAAI,UAAA;;;;UAOA,WAAA;EAChB,IAAA,EAAM,sBAAA;AAAA;AAAA,UAEU,SAAA;EAChB,OAAA;EACA,SAAA,EAAW,WAAA,IAAe,IAAA,EAAM,sBAAA;EAChC,MAAA;IACC,gBAAA;EAAA;AAAA;AAhDF;AAAA,iBAoDgB,EAAA,CAAG,OAAA,EAAS,SAAA,IAKnB,EAAA,EAAI,WAAA,KAAW,2BAAA,CAAA,iBAAA;AAAA,UAQP,oBAAA;EAChB,IAAA,EAAM,sBAAA;AAAA;AAAA,UAEU,kBAAA;EAChB,OAAA;EACA,SAAA,EAAW,oBAAA,IAAwB,IAAA,EAAM,sBAAA;EACzC,MAAA;IACC,gBAAA;EAAA;AAAA;;iBAIc,WAAA,CAAY,OAAA,EAAS,kBAAA,IAK5B,EAAA,EAAI,WAAA,KAAW,2BAAA,CAAA,iBAAA;AAAA,UAQP,gBAAA;EAChB,IAAA,EAAM,mBAAA;AAAA;AAAA,UAEU,cAAA;EAChB,OAAA;EACA,SAAA,EAAW,gBAAA,IAAoB,IAAA,EAAM,mBAAA;EACrC,MAAA;IACC,gBAAA;EAAA;EAED,aAAA;AAAA;;;;;iBAMe,OAAA,CAAQ,OAAA,EAAS,cAAA,IASxB,EAAA,EAAI,WAAA,KAAW,2BAAA,CAAA,iBAAA;AAAA,UASP,cAAA;EAChB,IAAA,EAAM,mBAAA;AAAA;AAAA,UAEU,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