@layerzerolabs/lz-iotal1-sdk-v2 3.0.143
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 +32 -0
- package/README.md +19 -0
- package/deployments/iotal1-mainnet/blocked_message_lib.json +58 -0
- package/deployments/iotal1-mainnet/blocked_msglib_ptb_builder.json +58 -0
- package/deployments/iotal1-mainnet/call.json +46 -0
- package/deployments/iotal1-mainnet/counter.json +85 -0
- package/deployments/iotal1-mainnet/dvn.json +49 -0
- package/deployments/iotal1-mainnet/dvn_call_type.json +45 -0
- package/deployments/iotal1-mainnet/dvn_fee_lib.json +59 -0
- package/deployments/iotal1-mainnet/dvn_layerzero.json +56 -0
- package/deployments/iotal1-mainnet/dvn_ptb_builder.json +45 -0
- package/deployments/iotal1-mainnet/endpoint_ptb_builder.json +70 -0
- package/deployments/iotal1-mainnet/endpoint_v2.json +86 -0
- package/deployments/iotal1-mainnet/executor.json +49 -0
- package/deployments/iotal1-mainnet/executor_call_type.json +45 -0
- package/deployments/iotal1-mainnet/executor_fee_lib.json +60 -0
- package/deployments/iotal1-mainnet/executor_layerzero.json +56 -0
- package/deployments/iotal1-mainnet/executor_ptb_builder.json +45 -0
- package/deployments/iotal1-mainnet/layerzero_views.json +46 -0
- package/deployments/iotal1-mainnet/message_lib_common.json +47 -0
- package/deployments/iotal1-mainnet/msglib_ptb_builder_call_types.json +45 -0
- package/deployments/iotal1-mainnet/multi_call.json +45 -0
- package/deployments/iotal1-mainnet/oapp.json +50 -0
- package/deployments/iotal1-mainnet/object-BlockedMessageLib.json +9 -0
- package/deployments/iotal1-mainnet/object-BlockedMsglibPtbBuilder.json +9 -0
- package/deployments/iotal1-mainnet/object-Counter.json +9 -0
- package/deployments/iotal1-mainnet/object-CounterAdminCap.json +9 -0
- package/deployments/iotal1-mainnet/object-CounterOApp.json +9 -0
- package/deployments/iotal1-mainnet/object-DVN.json +5 -0
- package/deployments/iotal1-mainnet/object-DVNCap.json +9 -0
- package/deployments/iotal1-mainnet/object-DVNFeeLib.json +9 -0
- package/deployments/iotal1-mainnet/object-EndpointPtbBuilder.json +9 -0
- package/deployments/iotal1-mainnet/object-EndpointPtbBuilderAdminCap.json +9 -0
- package/deployments/iotal1-mainnet/object-EndpointV2.json +9 -0
- package/deployments/iotal1-mainnet/object-EndpointV2AdminCap.json +9 -0
- package/deployments/iotal1-mainnet/object-Executor.json +5 -0
- package/deployments/iotal1-mainnet/object-ExecutorCap.json +9 -0
- package/deployments/iotal1-mainnet/object-ExecutorFeeLib.json +9 -0
- package/deployments/iotal1-mainnet/object-ExecutorOwnerCap.json +5 -0
- package/deployments/iotal1-mainnet/object-OFTComposerManager.json +9 -0
- package/deployments/iotal1-mainnet/object-PackageWhitelistValidator.json +9 -0
- package/deployments/iotal1-mainnet/object-PriceFeed.json +9 -0
- package/deployments/iotal1-mainnet/object-PriceFeedOwnerCap.json +9 -0
- package/deployments/iotal1-mainnet/object-SimpleMessageLib.json +9 -0
- package/deployments/iotal1-mainnet/object-SimpleMessageLibAdminCap.json +9 -0
- package/deployments/iotal1-mainnet/object-SmlPtbBuilder.json +9 -0
- package/deployments/iotal1-mainnet/object-Treasury.json +9 -0
- package/deployments/iotal1-mainnet/object-TreasuryAdminCap.json +9 -0
- package/deployments/iotal1-mainnet/object-ULN302.json +9 -0
- package/deployments/iotal1-mainnet/object-ULN302AdminCap.json +9 -0
- package/deployments/iotal1-mainnet/object-Uln302PtbBuilder.json +9 -0
- package/deployments/iotal1-mainnet/object-Uln302Verification.json +9 -0
- package/deployments/iotal1-mainnet/object-WorkerRegistry.json +9 -0
- package/deployments/iotal1-mainnet/object-ZroCoinMetadata.json +9 -0
- package/deployments/iotal1-mainnet/object-ZroTreasuryCap.json +9 -0
- package/deployments/iotal1-mainnet/oft_common.json +61 -0
- package/deployments/iotal1-mainnet/package_whitelist_validator.json +113 -0
- package/deployments/iotal1-mainnet/price_feed.json +70 -0
- package/deployments/iotal1-mainnet/price_feed_call_types.json +45 -0
- package/deployments/iotal1-mainnet/ptb_move_call.json +48 -0
- package/deployments/iotal1-mainnet/simple_message_lib.json +69 -0
- package/deployments/iotal1-mainnet/simple_msglib_ptb_builder.json +58 -0
- package/deployments/iotal1-mainnet/treasury.json +69 -0
- package/deployments/iotal1-mainnet/uln_302.json +87 -0
- package/deployments/iotal1-mainnet/uln_302_ptb_builder.json +58 -0
- package/deployments/iotal1-mainnet/uln_common.json +49 -0
- package/deployments/iotal1-mainnet/utils.json +57 -0
- package/deployments/iotal1-mainnet/worker_common.json +46 -0
- package/deployments/iotal1-mainnet/worker_registry.json +58 -0
- package/deployments/iotal1-mainnet/zro.json +67 -0
- package/deployments/iotal1-sandbox-local/blocked_message_lib.json +58 -0
- package/deployments/iotal1-sandbox-local/blocked_msglib_ptb_builder.json +58 -0
- package/deployments/iotal1-sandbox-local/call.json +46 -0
- package/deployments/iotal1-sandbox-local/counter.json +148 -0
- package/deployments/iotal1-sandbox-local/dvn.json +49 -0
- package/deployments/iotal1-sandbox-local/dvn_call_type.json +73 -0
- package/deployments/iotal1-sandbox-local/dvn_fee_lib.json +59 -0
- package/deployments/iotal1-sandbox-local/dvn_layerzero.json +56 -0
- package/deployments/iotal1-sandbox-local/dvn_ptb_builder.json +45 -0
- package/deployments/iotal1-sandbox-local/endpoint_ptb_builder.json +70 -0
- package/deployments/iotal1-sandbox-local/endpoint_v2.json +86 -0
- package/deployments/iotal1-sandbox-local/executor.json +49 -0
- package/deployments/iotal1-sandbox-local/executor_call_type.json +73 -0
- package/deployments/iotal1-sandbox-local/executor_fee_lib.json +60 -0
- package/deployments/iotal1-sandbox-local/executor_layerzero.json +56 -0
- package/deployments/iotal1-sandbox-local/executor_ptb_builder.json +45 -0
- package/deployments/iotal1-sandbox-local/layerzero_views.json +46 -0
- package/deployments/iotal1-sandbox-local/message_lib_common.json +47 -0
- package/deployments/iotal1-sandbox-local/msglib_ptb_builder_call_types.json +45 -0
- package/deployments/iotal1-sandbox-local/multi_call.json +45 -0
- package/deployments/iotal1-sandbox-local/oapp.json +50 -0
- package/deployments/iotal1-sandbox-local/object-BlockedMessageLib.json +9 -0
- package/deployments/iotal1-sandbox-local/object-BlockedMsglibPtbBuilder.json +9 -0
- package/deployments/iotal1-sandbox-local/object-Counter.json +9 -0
- package/deployments/iotal1-sandbox-local/object-CounterAdminCap.json +9 -0
- package/deployments/iotal1-sandbox-local/object-CounterOApp.json +9 -0
- package/deployments/iotal1-sandbox-local/object-DVN.json +5 -0
- package/deployments/iotal1-sandbox-local/object-DVNCap.json +9 -0
- package/deployments/iotal1-sandbox-local/object-DVNFeeLib.json +9 -0
- package/deployments/iotal1-sandbox-local/object-EndpointPtbBuilder.json +9 -0
- package/deployments/iotal1-sandbox-local/object-EndpointPtbBuilderAdminCap.json +9 -0
- package/deployments/iotal1-sandbox-local/object-EndpointV2.json +9 -0
- package/deployments/iotal1-sandbox-local/object-EndpointV2AdminCap.json +9 -0
- package/deployments/iotal1-sandbox-local/object-Executor.json +5 -0
- package/deployments/iotal1-sandbox-local/object-ExecutorCap.json +9 -0
- package/deployments/iotal1-sandbox-local/object-ExecutorFeeLib.json +9 -0
- package/deployments/iotal1-sandbox-local/object-ExecutorOwnerCap.json +5 -0
- package/deployments/iotal1-sandbox-local/object-PackageWhitelistValidator.json +9 -0
- package/deployments/iotal1-sandbox-local/object-PriceFeed.json +9 -0
- package/deployments/iotal1-sandbox-local/object-PriceFeedOwnerCap.json +9 -0
- package/deployments/iotal1-sandbox-local/object-SimpleMessageLib.json +9 -0
- package/deployments/iotal1-sandbox-local/object-SimpleMessageLibAdminCap.json +9 -0
- package/deployments/iotal1-sandbox-local/object-SmlPtbBuilder.json +9 -0
- package/deployments/iotal1-sandbox-local/object-Treasury.json +9 -0
- package/deployments/iotal1-sandbox-local/object-TreasuryAdminCap.json +9 -0
- package/deployments/iotal1-sandbox-local/object-ULN302.json +9 -0
- package/deployments/iotal1-sandbox-local/object-ULN302AdminCap.json +9 -0
- package/deployments/iotal1-sandbox-local/object-Uln302PtbBuilder.json +9 -0
- package/deployments/iotal1-sandbox-local/object-Uln302Verification.json +9 -0
- package/deployments/iotal1-sandbox-local/object-WorkerRegistry.json +9 -0
- package/deployments/iotal1-sandbox-local/object-ZroCoinMetadata.json +9 -0
- package/deployments/iotal1-sandbox-local/object-ZroTreasuryCap.json +9 -0
- package/deployments/iotal1-sandbox-local/package_whitelist_validator.json +113 -0
- package/deployments/iotal1-sandbox-local/price_feed.json +98 -0
- package/deployments/iotal1-sandbox-local/price_feed_call_types.json +45 -0
- package/deployments/iotal1-sandbox-local/ptb_move_call.json +48 -0
- package/deployments/iotal1-sandbox-local/simple_message_lib.json +69 -0
- package/deployments/iotal1-sandbox-local/simple_msglib_ptb_builder.json +58 -0
- package/deployments/iotal1-sandbox-local/treasury.json +97 -0
- package/deployments/iotal1-sandbox-local/uln_302.json +87 -0
- package/deployments/iotal1-sandbox-local/uln_302_ptb_builder.json +58 -0
- package/deployments/iotal1-sandbox-local/uln_common.json +49 -0
- package/deployments/iotal1-sandbox-local/utils.json +78 -0
- package/deployments/iotal1-sandbox-local/worker_common.json +46 -0
- package/deployments/iotal1-sandbox-local/worker_registry.json +58 -0
- package/deployments/iotal1-sandbox-local/zro.json +67 -0
- package/deployments/iotal1-testnet/blocked_message_lib.json +58 -0
- package/deployments/iotal1-testnet/blocked_msglib_ptb_builder.json +58 -0
- package/deployments/iotal1-testnet/call.json +46 -0
- package/deployments/iotal1-testnet/counter.json +85 -0
- package/deployments/iotal1-testnet/dvn.json +49 -0
- package/deployments/iotal1-testnet/dvn_call_type.json +45 -0
- package/deployments/iotal1-testnet/dvn_fee_lib.json +59 -0
- package/deployments/iotal1-testnet/dvn_layerzero.json +56 -0
- package/deployments/iotal1-testnet/dvn_ptb_builder.json +45 -0
- package/deployments/iotal1-testnet/endpoint_ptb_builder.json +70 -0
- package/deployments/iotal1-testnet/endpoint_v2.json +86 -0
- package/deployments/iotal1-testnet/executor.json +49 -0
- package/deployments/iotal1-testnet/executor_call_type.json +45 -0
- package/deployments/iotal1-testnet/executor_fee_lib.json +60 -0
- package/deployments/iotal1-testnet/executor_layerzero.json +56 -0
- package/deployments/iotal1-testnet/executor_ptb_builder.json +45 -0
- package/deployments/iotal1-testnet/layerzero_views.json +46 -0
- package/deployments/iotal1-testnet/message_lib_common.json +47 -0
- package/deployments/iotal1-testnet/msglib_ptb_builder_call_types.json +45 -0
- package/deployments/iotal1-testnet/multi_call.json +45 -0
- package/deployments/iotal1-testnet/oapp.json +50 -0
- package/deployments/iotal1-testnet/object-BlockedMessageLib.json +9 -0
- package/deployments/iotal1-testnet/object-BlockedMsglibPtbBuilder.json +9 -0
- package/deployments/iotal1-testnet/object-Counter.json +9 -0
- package/deployments/iotal1-testnet/object-CounterAdminCap.json +9 -0
- package/deployments/iotal1-testnet/object-CounterOApp.json +9 -0
- package/deployments/iotal1-testnet/object-DVN.json +5 -0
- package/deployments/iotal1-testnet/object-DVNCap.json +9 -0
- package/deployments/iotal1-testnet/object-DVNFeeLib.json +9 -0
- package/deployments/iotal1-testnet/object-EndpointPtbBuilder.json +9 -0
- package/deployments/iotal1-testnet/object-EndpointPtbBuilderAdminCap.json +9 -0
- package/deployments/iotal1-testnet/object-EndpointV2.json +9 -0
- package/deployments/iotal1-testnet/object-EndpointV2AdminCap.json +9 -0
- package/deployments/iotal1-testnet/object-Executor.json +5 -0
- package/deployments/iotal1-testnet/object-ExecutorCap.json +9 -0
- package/deployments/iotal1-testnet/object-ExecutorFeeLib.json +9 -0
- package/deployments/iotal1-testnet/object-ExecutorOwnerCap.json +5 -0
- package/deployments/iotal1-testnet/object-PackageWhitelistValidator.json +9 -0
- package/deployments/iotal1-testnet/object-PriceFeed.json +9 -0
- package/deployments/iotal1-testnet/object-PriceFeedOwnerCap.json +9 -0
- package/deployments/iotal1-testnet/object-SimpleMessageLib.json +9 -0
- package/deployments/iotal1-testnet/object-SimpleMessageLibAdminCap.json +9 -0
- package/deployments/iotal1-testnet/object-SmlPtbBuilder.json +9 -0
- package/deployments/iotal1-testnet/object-Treasury.json +9 -0
- package/deployments/iotal1-testnet/object-TreasuryAdminCap.json +9 -0
- package/deployments/iotal1-testnet/object-ULN302.json +9 -0
- package/deployments/iotal1-testnet/object-ULN302AdminCap.json +9 -0
- package/deployments/iotal1-testnet/object-Uln302PtbBuilder.json +9 -0
- package/deployments/iotal1-testnet/object-Uln302Verification.json +9 -0
- package/deployments/iotal1-testnet/object-WorkerRegistry.json +9 -0
- package/deployments/iotal1-testnet/object-ZroCoinMetadata.json +9 -0
- package/deployments/iotal1-testnet/object-ZroTreasuryCap.json +9 -0
- package/deployments/iotal1-testnet/package_whitelist_validator.json +113 -0
- package/deployments/iotal1-testnet/price_feed.json +70 -0
- package/deployments/iotal1-testnet/price_feed_call_types.json +45 -0
- package/deployments/iotal1-testnet/ptb_move_call.json +48 -0
- package/deployments/iotal1-testnet/simple_message_lib.json +69 -0
- package/deployments/iotal1-testnet/simple_msglib_ptb_builder.json +58 -0
- package/deployments/iotal1-testnet/treasury.json +69 -0
- package/deployments/iotal1-testnet/uln_302.json +87 -0
- package/deployments/iotal1-testnet/uln_302_ptb_builder.json +58 -0
- package/deployments/iotal1-testnet/uln_common.json +49 -0
- package/deployments/iotal1-testnet/utils.json +57 -0
- package/deployments/iotal1-testnet/worker_common.json +46 -0
- package/deployments/iotal1-testnet/worker_registry.json +58 -0
- package/deployments/iotal1-testnet/zro.json +67 -0
- package/dist/index.cjs +11279 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.mts +5824 -0
- package/dist/index.d.ts +5824 -0
- package/dist/index.mjs +11107 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +68 -0
- package/src/bcs/dvn.ts +7 -0
- package/src/bcs/endpoint.ts +7 -0
- package/src/bcs/executor.ts +27 -0
- package/src/bcs/index.ts +8 -0
- package/src/bcs/messaging-fee.ts +6 -0
- package/src/bcs/move-call.ts +28 -0
- package/src/bcs/oapp.ts +14 -0
- package/src/bcs/price-feed.ts +21 -0
- package/src/bcs/uln.ts +15 -0
- package/src/generated/addresses.ts +344 -0
- package/src/index.ts +5 -0
- package/src/module-manager.ts +360 -0
- package/src/modules/call.ts +245 -0
- package/src/modules/endpoint.ts +2417 -0
- package/src/modules/index.ts +10 -0
- package/src/modules/layerzero-views.ts +205 -0
- package/src/modules/message-libs/blocked-message-lib.ts +112 -0
- package/src/modules/message-libs/index.ts +4 -0
- package/src/modules/message-libs/simple-message-lib.ts +270 -0
- package/src/modules/message-libs/uln302.ts +827 -0
- package/src/modules/oapps/counter.ts +458 -0
- package/src/modules/oapps/index.ts +3 -0
- package/src/modules/oapps/oapp.ts +744 -0
- package/src/modules/ptb-builders/blocked-message-lib-ptb-builder.ts +49 -0
- package/src/modules/ptb-builders/dvn-ptb-builder.ts +58 -0
- package/src/modules/ptb-builders/endpoint-ptb-builder.ts +520 -0
- package/src/modules/ptb-builders/executor-ptb-builder.ts +58 -0
- package/src/modules/ptb-builders/index.ts +9 -0
- package/src/modules/ptb-builders/package-whitelist-validator.ts +142 -0
- package/src/modules/ptb-builders/ptb-builder.ts +357 -0
- package/src/modules/ptb-builders/simple-message-lib-ptb-builder.ts +53 -0
- package/src/modules/ptb-builders/uln302-ptb-builder.ts +222 -0
- package/src/modules/utils.ts +902 -0
- package/src/modules/workers/dvn-fee-lib.ts +89 -0
- package/src/modules/workers/dvn-layerzero.ts +85 -0
- package/src/modules/workers/dvn.ts +1727 -0
- package/src/modules/workers/executor-fee-lib.ts +94 -0
- package/src/modules/workers/executor-layerzero.ts +79 -0
- package/src/modules/workers/executor.ts +1170 -0
- package/src/modules/workers/index.ts +10 -0
- package/src/modules/workers/price-feed.ts +575 -0
- package/src/modules/workers/treasury.ts +295 -0
- package/src/modules/workers/worker-registry.ts +110 -0
- package/src/modules/zro.ts +94 -0
- package/src/resource.ts +104 -0
- package/src/sdk.ts +183 -0
- package/src/types/dvn.ts +20 -0
- package/src/types/endpoint.ts +16 -0
- package/src/types/errors.ts +10 -0
- package/src/types/executor.ts +23 -0
- package/src/types/index.ts +13 -0
- package/src/types/layerzero-views.ts +59 -0
- package/src/types/message-lib.ts +38 -0
- package/src/types/modules.ts +36 -0
- package/src/types/move-types.ts +24 -0
- package/src/types/oapp.ts +6 -0
- package/src/types/options.ts +333 -0
- package/src/types/price-feed.ts +21 -0
- package/src/types/ptb-builder.ts +29 -0
- package/src/types/simulation.ts +8 -0
- package/src/utils/argument.ts +198 -0
- package/src/utils/index.ts +8 -0
- package/src/utils/move-call-object-fetcher.ts +105 -0
- package/src/utils/non-sender-object-validator.ts +102 -0
- package/src/utils/package-allowlist-validator.ts +134 -0
- package/src/utils/ptb-validator.ts +14 -0
- package/src/utils/share-object-validator.ts +37 -0
- package/src/utils/transaction.ts +157 -0
- package/src/utils/type-name.ts +99 -0
- package/src/utils/validate-with-details.ts +50 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Re-export all modules from organized subdirectories
|
|
2
|
+
export * from './endpoint'
|
|
3
|
+
export * from './message-libs'
|
|
4
|
+
export * from './workers'
|
|
5
|
+
export * from './ptb-builders'
|
|
6
|
+
export * from './oapps'
|
|
7
|
+
export * from './layerzero-views'
|
|
8
|
+
export * from './call'
|
|
9
|
+
export * from './utils'
|
|
10
|
+
export * from './zro'
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { bcs } from '@iota/iota-sdk/bcs'
|
|
2
|
+
import { IotaClient } from '@iota/iota-sdk/client'
|
|
3
|
+
|
|
4
|
+
import { ModuleManager } from '../module-manager'
|
|
5
|
+
import {
|
|
6
|
+
EndpointExecutionState,
|
|
7
|
+
EndpointExecutionStateType,
|
|
8
|
+
ExecutableParams,
|
|
9
|
+
InitializableParams,
|
|
10
|
+
ObjectOptions,
|
|
11
|
+
UlnVerifiableParams,
|
|
12
|
+
UlnVerificationState,
|
|
13
|
+
UlnVerificationStateType,
|
|
14
|
+
VerifiableParams,
|
|
15
|
+
} from '../types'
|
|
16
|
+
import { asBytes, asObject, asU32, asU64, executeSimulate } from '../utils'
|
|
17
|
+
|
|
18
|
+
const MODULE_NAME_ENDPOINT_VIEWS = 'endpoint_views'
|
|
19
|
+
const MODULE_NAME_ULN_302_VIEWS = 'uln_302_views'
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* LayerZero Views SDK
|
|
23
|
+
*
|
|
24
|
+
* Provides view functions for checking the state of LayerZero messages
|
|
25
|
+
* and their executability/verification status without modifying state.
|
|
26
|
+
*/
|
|
27
|
+
export class LayerZeroViews {
|
|
28
|
+
public packageId: string
|
|
29
|
+
public readonly client: IotaClient
|
|
30
|
+
private readonly objects: ObjectOptions
|
|
31
|
+
|
|
32
|
+
constructor(
|
|
33
|
+
packageId: string,
|
|
34
|
+
client: IotaClient,
|
|
35
|
+
objects: ObjectOptions,
|
|
36
|
+
private readonly moduleManager: ModuleManager
|
|
37
|
+
) {
|
|
38
|
+
this.packageId = packageId
|
|
39
|
+
this.client = client
|
|
40
|
+
this.objects = objects
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// ======== Endpoint View Functions ========
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Checks if a message path is initializable (channel exists).
|
|
47
|
+
*
|
|
48
|
+
* @param params - Parameters containing messaging channel, source EID, and sender
|
|
49
|
+
* @returns Promise<boolean> - True if the path is initializable
|
|
50
|
+
*/
|
|
51
|
+
async initializable(params: InitializableParams): Promise<boolean> {
|
|
52
|
+
return executeSimulate(
|
|
53
|
+
this.client,
|
|
54
|
+
(tx) => {
|
|
55
|
+
tx.moveCall({
|
|
56
|
+
target: this.#endpointViewsTarget('initializable'),
|
|
57
|
+
arguments: [
|
|
58
|
+
asObject(tx, params.messagingChannel),
|
|
59
|
+
asU32(tx, params.srcEid),
|
|
60
|
+
asBytes(tx, params.sender),
|
|
61
|
+
],
|
|
62
|
+
})
|
|
63
|
+
},
|
|
64
|
+
(result) => bcs.Bool.parse(result[0].value)
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Checks if a message is verifiable by the endpoint.
|
|
70
|
+
*
|
|
71
|
+
* @param params - Parameters containing messaging channel, source EID, sender, and nonce
|
|
72
|
+
* @returns Promise<boolean> - True if the message is verifiable
|
|
73
|
+
*/
|
|
74
|
+
async verifiable(params: VerifiableParams): Promise<boolean> {
|
|
75
|
+
return executeSimulate(
|
|
76
|
+
this.client,
|
|
77
|
+
(tx) => {
|
|
78
|
+
tx.moveCall({
|
|
79
|
+
target: this.#endpointViewsTarget('verifiable'),
|
|
80
|
+
arguments: [
|
|
81
|
+
asObject(tx, params.messagingChannel),
|
|
82
|
+
asU32(tx, params.srcEid),
|
|
83
|
+
asBytes(tx, params.sender),
|
|
84
|
+
asU64(tx, params.nonce),
|
|
85
|
+
],
|
|
86
|
+
})
|
|
87
|
+
},
|
|
88
|
+
(result) => bcs.Bool.parse(result[0].value)
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Determines the execution state of a message.
|
|
94
|
+
*
|
|
95
|
+
* @param params - Parameters containing messaging channel, source EID, sender, and nonce
|
|
96
|
+
* @returns Promise<EndpointExecutionStateType> - The current execution state
|
|
97
|
+
*/
|
|
98
|
+
async executable(params: ExecutableParams): Promise<EndpointExecutionStateType> {
|
|
99
|
+
return executeSimulate(
|
|
100
|
+
this.client,
|
|
101
|
+
(tx) => {
|
|
102
|
+
tx.moveCall({
|
|
103
|
+
target: this.#endpointViewsTarget('executable'),
|
|
104
|
+
arguments: [
|
|
105
|
+
asObject(tx, params.messagingChannel),
|
|
106
|
+
asU32(tx, params.srcEid),
|
|
107
|
+
asBytes(tx, params.sender),
|
|
108
|
+
asU64(tx, params.nonce),
|
|
109
|
+
],
|
|
110
|
+
})
|
|
111
|
+
},
|
|
112
|
+
(result) => bcs.U8.parse(result[0].value) as EndpointExecutionStateType
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// ======== ULN 302 View Functions ========
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Checks the verification state of a message through the ULN 302.
|
|
120
|
+
*
|
|
121
|
+
* @param params - Parameters containing ULN, verification, messaging channel, packet header, and payload hash
|
|
122
|
+
* @returns Promise<UlnVerificationStateType> - The current verification state
|
|
123
|
+
*/
|
|
124
|
+
async ulnVerifiable(params: UlnVerifiableParams): Promise<UlnVerificationStateType> {
|
|
125
|
+
return executeSimulate(
|
|
126
|
+
this.client,
|
|
127
|
+
(tx) => {
|
|
128
|
+
tx.moveCall({
|
|
129
|
+
target: this.#uln302ViewsTarget('verifiable'),
|
|
130
|
+
arguments: [
|
|
131
|
+
tx.object(this.objects.uln302),
|
|
132
|
+
asObject(tx, params.verification),
|
|
133
|
+
tx.object(this.objects.endpointV2),
|
|
134
|
+
asObject(tx, params.messagingChannel),
|
|
135
|
+
asBytes(tx, params.packetHeaderBytes),
|
|
136
|
+
asBytes(tx, params.payloadHash),
|
|
137
|
+
],
|
|
138
|
+
})
|
|
139
|
+
},
|
|
140
|
+
(result) => bcs.U8.parse(result[0].value) as UlnVerificationStateType
|
|
141
|
+
)
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// ======== Utility Functions ========
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Gets the human-readable name for an endpoint execution state
|
|
148
|
+
* @param state - The endpoint execution state enum value
|
|
149
|
+
* @returns Human-readable string representation of the execution state
|
|
150
|
+
*/
|
|
151
|
+
static getExecutionStateName(state: EndpointExecutionStateType): string {
|
|
152
|
+
switch (state) {
|
|
153
|
+
case EndpointExecutionState.STATE_NOT_EXECUTABLE:
|
|
154
|
+
return 'NOT_EXECUTABLE'
|
|
155
|
+
case EndpointExecutionState.STATE_VERIFIED_BUT_NOT_EXECUTABLE:
|
|
156
|
+
return 'VERIFIED_BUT_NOT_EXECUTABLE'
|
|
157
|
+
case EndpointExecutionState.STATE_EXECUTABLE:
|
|
158
|
+
return 'EXECUTABLE'
|
|
159
|
+
case EndpointExecutionState.STATE_EXECUTED:
|
|
160
|
+
return 'EXECUTED'
|
|
161
|
+
default:
|
|
162
|
+
return 'UNKNOWN'
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Gets the human-readable name for a ULN verification state
|
|
168
|
+
* @param state - The ULN verification state enum value
|
|
169
|
+
* @returns Human-readable string representation of the verification state
|
|
170
|
+
*/
|
|
171
|
+
static getVerificationStateName(state: UlnVerificationStateType): string {
|
|
172
|
+
switch (state) {
|
|
173
|
+
case UlnVerificationState.STATE_VERIFYING:
|
|
174
|
+
return 'VERIFYING'
|
|
175
|
+
case UlnVerificationState.STATE_VERIFIABLE:
|
|
176
|
+
return 'VERIFIABLE'
|
|
177
|
+
case UlnVerificationState.STATE_VERIFIED:
|
|
178
|
+
return 'VERIFIED'
|
|
179
|
+
case UlnVerificationState.STATE_NOT_INITIALIZABLE:
|
|
180
|
+
return 'NOT_INITIALIZABLE'
|
|
181
|
+
default:
|
|
182
|
+
return 'UNKNOWN'
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// ======== Private Helper Methods ========
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Generate the full target path for endpoint view functions
|
|
190
|
+
* @param functionName - The function name to call
|
|
191
|
+
* @returns The full module path for the move call
|
|
192
|
+
*/
|
|
193
|
+
#endpointViewsTarget(functionName: string): string {
|
|
194
|
+
return `${this.packageId}::${MODULE_NAME_ENDPOINT_VIEWS}::${functionName}`
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Generate the full target path for ULN302 view functions
|
|
199
|
+
* @param functionName - The function name to call
|
|
200
|
+
* @returns The full module path for the move call
|
|
201
|
+
*/
|
|
202
|
+
#uln302ViewsTarget(functionName: string): string {
|
|
203
|
+
return `${this.packageId}::${MODULE_NAME_ULN_302_VIEWS}::${functionName}`
|
|
204
|
+
}
|
|
205
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { bcs } from '@iota/iota-sdk/bcs'
|
|
2
|
+
import { IotaClient } from '@iota/iota-sdk/client'
|
|
3
|
+
import { Transaction, TransactionArgument, TransactionResult } from '@iota/iota-sdk/transactions'
|
|
4
|
+
|
|
5
|
+
import { ModuleManager } from '../../module-manager'
|
|
6
|
+
import { ObjectOptions } from '../../types'
|
|
7
|
+
import { executeSimulate } from '../../utils'
|
|
8
|
+
|
|
9
|
+
const MODULE_NAME = 'blocked_message_lib'
|
|
10
|
+
|
|
11
|
+
export const BlockedMessageLibErrorCode = {
|
|
12
|
+
// BlockedMessageLib related errors (with BlockedMessageLib_ prefix)
|
|
13
|
+
BlockedMessageLib_ENotImplemented: 1,
|
|
14
|
+
} as const
|
|
15
|
+
|
|
16
|
+
export class BlockedMessageLib {
|
|
17
|
+
public packageId: string
|
|
18
|
+
public readonly client: IotaClient
|
|
19
|
+
private readonly objects: ObjectOptions
|
|
20
|
+
|
|
21
|
+
constructor(
|
|
22
|
+
packageId: string,
|
|
23
|
+
client: IotaClient,
|
|
24
|
+
objects: ObjectOptions,
|
|
25
|
+
private readonly moduleManager: ModuleManager
|
|
26
|
+
) {
|
|
27
|
+
this.packageId = packageId
|
|
28
|
+
this.client = client
|
|
29
|
+
this.objects = objects
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// === Set Functions ===
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Quote messaging fees (always throws not implemented error)
|
|
36
|
+
* @param tx - The transaction to add the move call to
|
|
37
|
+
* @param call - The call transaction result or transaction argument
|
|
38
|
+
*/
|
|
39
|
+
quoteMoveCall(tx: Transaction, call: TransactionArgument): void {
|
|
40
|
+
tx.moveCall({
|
|
41
|
+
target: this.#target('quote'),
|
|
42
|
+
arguments: [tx.object(this.objects.blockedMessageLib), call],
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Send message (always throws not implemented error)
|
|
48
|
+
* @param tx - The transaction to add the move call to
|
|
49
|
+
* @param call - The call transaction result or transaction argument
|
|
50
|
+
*/
|
|
51
|
+
sendMoveCall(tx: Transaction, call: TransactionArgument): void {
|
|
52
|
+
tx.moveCall({
|
|
53
|
+
target: this.#target('send'),
|
|
54
|
+
arguments: [tx.object(this.objects.blockedMessageLib), call],
|
|
55
|
+
})
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Set configuration (always throws not implemented error)
|
|
60
|
+
* @param tx - The transaction to add the move call to
|
|
61
|
+
* @param call - The call transaction result or transaction argument
|
|
62
|
+
*/
|
|
63
|
+
setConfigMoveCall(tx: Transaction, call: TransactionArgument): void {
|
|
64
|
+
tx.moveCall({
|
|
65
|
+
target: this.#target('set_config'),
|
|
66
|
+
arguments: [tx.object(this.objects.blockedMessageLib), call],
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// === View Functions ===
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Get blocked message library version
|
|
74
|
+
* @param tx - The transaction to add the move call to
|
|
75
|
+
* @returns Transaction result containing the version information
|
|
76
|
+
*/
|
|
77
|
+
versionMoveCall(tx: Transaction): TransactionResult {
|
|
78
|
+
return tx.moveCall({
|
|
79
|
+
target: this.#target('version'),
|
|
80
|
+
arguments: [],
|
|
81
|
+
})
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Get blocked message library version
|
|
86
|
+
* @returns Promise<[string, string, string]> - Tuple of [major, minor, endpoint] version strings
|
|
87
|
+
*/
|
|
88
|
+
async getVersion(): Promise<[string, string, string]> {
|
|
89
|
+
return executeSimulate(
|
|
90
|
+
this.client,
|
|
91
|
+
(tx) => {
|
|
92
|
+
this.versionMoveCall(tx)
|
|
93
|
+
},
|
|
94
|
+
(result) => [
|
|
95
|
+
bcs.U64.parse(result[0].value).toString(),
|
|
96
|
+
bcs.U8.parse(result[1].value).toString(),
|
|
97
|
+
bcs.U8.parse(result[2].value).toString(),
|
|
98
|
+
]
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Generate the full target path for move calls
|
|
104
|
+
* @param name - The function name to call
|
|
105
|
+
* @param module_name - The module name (defaults to MODULE_NAME)
|
|
106
|
+
* @returns The full module path for the move call
|
|
107
|
+
* @private
|
|
108
|
+
*/
|
|
109
|
+
#target(name: string, module_name: string = MODULE_NAME): string {
|
|
110
|
+
return `${this.packageId}::${module_name}::${name}`
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
import { bcs } from '@iota/iota-sdk/bcs'
|
|
2
|
+
import { IotaClient } from '@iota/iota-sdk/client'
|
|
3
|
+
import { Transaction, TransactionArgument, TransactionResult } from '@iota/iota-sdk/transactions'
|
|
4
|
+
|
|
5
|
+
import { ModuleManager } from '../../module-manager'
|
|
6
|
+
import { ObjectOptions } from '../../types'
|
|
7
|
+
import { asAddress, asBytes, asBytes32, asObject, asU64, executeSimulate } from '../../utils'
|
|
8
|
+
|
|
9
|
+
const MODULE_NAME = 'simple_message_lib'
|
|
10
|
+
|
|
11
|
+
export const SimpleMessageLibErrorCode = {
|
|
12
|
+
// SimpleMessageLib related errors (matching simple_message_lib.move)
|
|
13
|
+
SimpleMessageLib_ENotImplemented: 1,
|
|
14
|
+
SimpleMessageLib_EZROFeeNotEnabled: 2,
|
|
15
|
+
SimpleMessageLib_EInvalidEid: 3,
|
|
16
|
+
} as const
|
|
17
|
+
|
|
18
|
+
export class SimpleMessageLib {
|
|
19
|
+
public packageId: string
|
|
20
|
+
public readonly client: IotaClient
|
|
21
|
+
private readonly objects: ObjectOptions
|
|
22
|
+
|
|
23
|
+
constructor(
|
|
24
|
+
packageId: string,
|
|
25
|
+
client: IotaClient,
|
|
26
|
+
objects: ObjectOptions,
|
|
27
|
+
private readonly moduleManager: ModuleManager
|
|
28
|
+
) {
|
|
29
|
+
this.packageId = packageId
|
|
30
|
+
this.client = client
|
|
31
|
+
this.objects = objects
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// === Set Functions ===
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Set messaging fees for simple message library (admin only)
|
|
38
|
+
* @param tx - The transaction to add the move call to
|
|
39
|
+
* @param zroFee - The ZRO token fee amount or transaction argument
|
|
40
|
+
* @param nativeFee - The native token fee amount or transaction argument
|
|
41
|
+
*/
|
|
42
|
+
setMessagingFeeMoveCall(
|
|
43
|
+
tx: Transaction,
|
|
44
|
+
zroFee: number | TransactionArgument,
|
|
45
|
+
nativeFee: number | TransactionArgument
|
|
46
|
+
): void {
|
|
47
|
+
tx.moveCall({
|
|
48
|
+
target: this.#target('set_messaging_fee'),
|
|
49
|
+
arguments: [
|
|
50
|
+
tx.object(this.objects.simpleMessageLib),
|
|
51
|
+
tx.object(this.objects.simpleMessageLibAdminCap),
|
|
52
|
+
asU64(tx, zroFee),
|
|
53
|
+
asU64(tx, nativeFee),
|
|
54
|
+
],
|
|
55
|
+
})
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Set fee recipient address (admin only)
|
|
60
|
+
* @param tx - The transaction to add the move call to
|
|
61
|
+
* @param feeRecipient - The new fee recipient address or transaction argument
|
|
62
|
+
*/
|
|
63
|
+
setFeeRecipientMoveCall(tx: Transaction, feeRecipient: string | TransactionArgument): void {
|
|
64
|
+
tx.moveCall({
|
|
65
|
+
target: this.#target('set_fee_recipient'),
|
|
66
|
+
arguments: [
|
|
67
|
+
tx.object(this.objects.simpleMessageLib),
|
|
68
|
+
tx.object(this.objects.endpointAdminCap),
|
|
69
|
+
asAddress(tx, feeRecipient),
|
|
70
|
+
],
|
|
71
|
+
})
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Validate packet for simple message processing
|
|
76
|
+
* @param tx - The transaction to add the move call to
|
|
77
|
+
* @param messagingChannel - The messaging channel object ID or transaction argument
|
|
78
|
+
* @param packetHeader - The packet header as bytes or transaction argument
|
|
79
|
+
* @param payloadHash - The payload hash as bytes or transaction argument
|
|
80
|
+
*/
|
|
81
|
+
validatePacketMoveCall(
|
|
82
|
+
tx: Transaction,
|
|
83
|
+
messagingChannel: string | TransactionArgument,
|
|
84
|
+
packetHeader: Uint8Array | TransactionArgument,
|
|
85
|
+
payloadHash: Uint8Array | TransactionArgument
|
|
86
|
+
): void {
|
|
87
|
+
tx.moveCall({
|
|
88
|
+
target: this.#target('validate_packet'),
|
|
89
|
+
arguments: [
|
|
90
|
+
tx.object(this.objects.simpleMessageLib),
|
|
91
|
+
tx.object(this.objects.endpointV2),
|
|
92
|
+
tx.object(this.objects.simpleMessageLibAdminCap),
|
|
93
|
+
asObject(tx, messagingChannel),
|
|
94
|
+
asBytes(tx, packetHeader),
|
|
95
|
+
asBytes32(tx, payloadHash, this.moduleManager.getUtils()),
|
|
96
|
+
tx.object.clock(),
|
|
97
|
+
],
|
|
98
|
+
})
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Set configuration for simple message library
|
|
103
|
+
* @param tx - The transaction to add the move call to
|
|
104
|
+
* @param call - The call transaction result containing configuration or transaction argument
|
|
105
|
+
*/
|
|
106
|
+
setConfigMoveCall(tx: Transaction, call: TransactionArgument): void {
|
|
107
|
+
tx.moveCall({
|
|
108
|
+
target: this.#target('set_config'),
|
|
109
|
+
arguments: [tx.object(this.objects.simpleMessageLib), call],
|
|
110
|
+
})
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Quote messaging fees for simple message library
|
|
115
|
+
* @param tx - The transaction to add the move call to
|
|
116
|
+
* @param call - The call transaction result containing quote parameters or transaction argument
|
|
117
|
+
*/
|
|
118
|
+
quoteMoveCall(tx: Transaction, call: TransactionArgument): void {
|
|
119
|
+
tx.moveCall({
|
|
120
|
+
target: this.#target('quote'),
|
|
121
|
+
arguments: [tx.object(this.objects.simpleMessageLib), call],
|
|
122
|
+
})
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Send message through simple message library
|
|
127
|
+
* @param tx - The transaction to add the move call to
|
|
128
|
+
* @param messageChannel - The messaging channel object ID or transaction argument
|
|
129
|
+
* @param endpointCall - The endpoint call transaction result or transaction argument
|
|
130
|
+
* @param messageLibCall - The message library call transaction result or transaction argument
|
|
131
|
+
*/
|
|
132
|
+
sendMoveCall(
|
|
133
|
+
tx: Transaction,
|
|
134
|
+
messageChannel: string | TransactionArgument,
|
|
135
|
+
endpointCall: TransactionArgument,
|
|
136
|
+
messageLibCall: TransactionArgument
|
|
137
|
+
): void {
|
|
138
|
+
tx.moveCall({
|
|
139
|
+
target: this.#target('send'),
|
|
140
|
+
arguments: [
|
|
141
|
+
tx.object(this.objects.simpleMessageLib),
|
|
142
|
+
tx.object(this.objects.endpointV2),
|
|
143
|
+
asObject(tx, messageChannel),
|
|
144
|
+
endpointCall,
|
|
145
|
+
messageLibCall,
|
|
146
|
+
],
|
|
147
|
+
})
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// === View Functions ===
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Get native token fee amount
|
|
154
|
+
* @param tx - The transaction to add the move call to
|
|
155
|
+
* @returns Transaction result containing the native fee
|
|
156
|
+
*/
|
|
157
|
+
getNativeFeeMoveCall(tx: Transaction): TransactionResult {
|
|
158
|
+
return tx.moveCall({
|
|
159
|
+
target: this.#target('get_native_fee'),
|
|
160
|
+
arguments: [tx.object(this.objects.simpleMessageLib)],
|
|
161
|
+
})
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Get native token fee amount
|
|
166
|
+
* @returns Promise<string> - The native token fee as string
|
|
167
|
+
*/
|
|
168
|
+
async getNativeFee(): Promise<string> {
|
|
169
|
+
return executeSimulate(
|
|
170
|
+
this.client,
|
|
171
|
+
(tx) => {
|
|
172
|
+
this.getNativeFeeMoveCall(tx)
|
|
173
|
+
},
|
|
174
|
+
(result) => bcs.U64.parse(result[0].value)
|
|
175
|
+
)
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Get ZRO token fee amount
|
|
180
|
+
* @param tx - The transaction to add the move call to
|
|
181
|
+
* @returns Transaction result containing the ZRO fee
|
|
182
|
+
*/
|
|
183
|
+
getZroFeeMoveCall(tx: Transaction): TransactionResult {
|
|
184
|
+
return tx.moveCall({
|
|
185
|
+
target: this.#target('get_zro_fee'),
|
|
186
|
+
arguments: [tx.object(this.objects.simpleMessageLib)],
|
|
187
|
+
})
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Get ZRO token fee amount
|
|
192
|
+
* @returns Promise<string> - The ZRO token fee as string
|
|
193
|
+
*/
|
|
194
|
+
async getZroFee(): Promise<string> {
|
|
195
|
+
return executeSimulate(
|
|
196
|
+
this.client,
|
|
197
|
+
(tx) => {
|
|
198
|
+
this.getZroFeeMoveCall(tx)
|
|
199
|
+
},
|
|
200
|
+
(result) => bcs.U64.parse(result[0].value)
|
|
201
|
+
)
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Get fee recipient address
|
|
206
|
+
* @param tx - The transaction to add the move call to
|
|
207
|
+
* @returns Transaction result containing the fee recipient address
|
|
208
|
+
*/
|
|
209
|
+
getFeeRecipientMoveCall(tx: Transaction): TransactionResult {
|
|
210
|
+
return tx.moveCall({
|
|
211
|
+
target: this.#target('get_fee_recipient'),
|
|
212
|
+
arguments: [tx.object(this.objects.simpleMessageLib)],
|
|
213
|
+
})
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Get fee recipient address
|
|
218
|
+
* @returns Promise<string> - The fee recipient address
|
|
219
|
+
*/
|
|
220
|
+
async getFeeRecipient(): Promise<string> {
|
|
221
|
+
return executeSimulate(
|
|
222
|
+
this.client,
|
|
223
|
+
(tx) => {
|
|
224
|
+
this.getFeeRecipientMoveCall(tx)
|
|
225
|
+
},
|
|
226
|
+
(result) => bcs.Address.parse(result[0].value)
|
|
227
|
+
)
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Get simple message library version
|
|
232
|
+
* @param tx - The transaction to add the move call to
|
|
233
|
+
* @returns Transaction result containing the version information
|
|
234
|
+
*/
|
|
235
|
+
versionMoveCall(tx: Transaction): TransactionResult {
|
|
236
|
+
return tx.moveCall({
|
|
237
|
+
target: this.#target('version'),
|
|
238
|
+
arguments: [],
|
|
239
|
+
})
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Get simple message library version
|
|
244
|
+
* @returns Promise<[string, string, string]> - Tuple of [major, minor, endpoint] version strings
|
|
245
|
+
*/
|
|
246
|
+
async getVersion(): Promise<[string, string, string]> {
|
|
247
|
+
return executeSimulate(
|
|
248
|
+
this.client,
|
|
249
|
+
(tx) => {
|
|
250
|
+
this.versionMoveCall(tx)
|
|
251
|
+
},
|
|
252
|
+
(result) => [
|
|
253
|
+
bcs.U64.parse(result[0].value).toString(),
|
|
254
|
+
bcs.U8.parse(result[1].value).toString(),
|
|
255
|
+
bcs.U8.parse(result[2].value).toString(),
|
|
256
|
+
]
|
|
257
|
+
)
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Generate the full target path for move calls
|
|
262
|
+
* @param name - The function name to call
|
|
263
|
+
* @param module_name - The module name (defaults to MODULE_NAME)
|
|
264
|
+
* @returns The full module path for the move call
|
|
265
|
+
* @private
|
|
266
|
+
*/
|
|
267
|
+
#target(name: string, module_name: string = MODULE_NAME): string {
|
|
268
|
+
return `${this.packageId}::${module_name}::${name}`
|
|
269
|
+
}
|
|
270
|
+
}
|