@layerzerolabs/lz-movevm-sdk-v2 3.0.2-initia.0 → 3.0.2-initia.1
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 +14 -0
- package/README.md +124 -1
- package/dist/index.cjs +1041 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +1183 -1
- package/dist/index.d.ts +1183 -1
- package/dist/index.mjs +1021 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @layerzerolabs/lz-movevm-sdk-v2
|
|
2
2
|
|
|
3
|
+
## 3.0.2-initia.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Build new Initia snapshot images
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @layerzerolabs/lz-corekit-aptos@3.0.2-initia.1
|
|
10
|
+
- @layerzerolabs/lz-core@3.0.2-initia.1
|
|
11
|
+
- @layerzerolabs/lz-definitions@3.0.2-initia.1
|
|
12
|
+
- @layerzerolabs/lz-serdes@3.0.2-initia.1
|
|
13
|
+
- @layerzerolabs/lz-utilities@3.0.2-initia.1
|
|
14
|
+
- @layerzerolabs/lz-v2-utilities@3.0.2-initia.1
|
|
15
|
+
- @layerzerolabs/move-definitions@3.0.2-initia.1
|
|
16
|
+
|
|
3
17
|
## 3.0.2-initia.0
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1 +1,124 @@
|
|
|
1
|
-
#
|
|
1
|
+
# MoveVM SDK
|
|
2
|
+
|
|
3
|
+
The MoveVM SDK is a comprehensive toolkit designed to interact with the Move-based blockchain. It provides a set of utilities and modules to facilitate the development and integration of applications with the MoveVM.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Price Feed Management**: Interact with price feeds, set and get prices.
|
|
8
|
+
- **ULN Configuration**: Manage ULN configurations for sending and receiving messages.
|
|
9
|
+
- **Executor Configuration**: Set and get executor configurations.
|
|
10
|
+
- **Worker Management**: Manage worker configurations and price feeds.
|
|
11
|
+
- **View Functions**: Execute view functions to retrieve data from the blockchain.
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
To install the MoveVM SDK, you can use npm or yarn:
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
npm install @layerzerolabs/movevm-sdk
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
or
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
yarn add @layerzerolabs/movevm-sdk
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
Normally you don't need to use this package directly, you can use **@layerzerolabs/lz-aptos-sdk-v2** or **@layerzerolabs/lz-initia-sdk-v2** to interact with Aptos or Initia blockchain, both of them have implemented the **MoveSdkImpl** interface.
|
|
30
|
+
|
|
31
|
+
However, if you need to interact with other blockchains but neither Aptos nor Initia, you need to create your own SDK first, add **@layerzerolabs/movevm-sdk** as a dependency, and implements the **MoveSdkImpl** interface.
|
|
32
|
+
|
|
33
|
+
Here's an example from **@layerzerolabs/lz-initia-sdk-v2**
|
|
34
|
+
|
|
35
|
+
### Initialization
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
import { AccountsOption, LayerZeroModulesSdk, MoveSdkImpl } from '@layerzerolabs/lz-movevm-sdk-v2'
|
|
39
|
+
import { MnemonicKey } from '@initia/initia.js'
|
|
40
|
+
import {
|
|
41
|
+
EntryFunctionArgumentTypes,
|
|
42
|
+
GasOptions,
|
|
43
|
+
MnemonicAndPath,
|
|
44
|
+
MoveFunction,
|
|
45
|
+
MoveStructId,
|
|
46
|
+
MoveValue,
|
|
47
|
+
PrivateKey,
|
|
48
|
+
TableItemRequest,
|
|
49
|
+
TransactionResponse
|
|
50
|
+
} from '@layerzerolabs/move-definitions'
|
|
51
|
+
|
|
52
|
+
export class SDK implements MoveSdkImpl<MnemonicKey> {
|
|
53
|
+
LayerzeroModule: LayerZeroModulesSdk<MnemonicKey>
|
|
54
|
+
accounts: AccountsOption
|
|
55
|
+
constructor() {
|
|
56
|
+
this.accounts = {
|
|
57
|
+
price_feed: '0x1',
|
|
58
|
+
uln_message_lib: '0x2',
|
|
59
|
+
worker_common: '0x3',
|
|
60
|
+
layerzero_views: '0x4',
|
|
61
|
+
},
|
|
62
|
+
this.LayerzeroModule = new LayerZeroModulesSdk(this)
|
|
63
|
+
|
|
64
|
+
async viewFunction(args: {
|
|
65
|
+
functionName: MoveFunction
|
|
66
|
+
functionArgs: EntryFunctionArgumentTypes[]
|
|
67
|
+
functionArgTypes?: string[]
|
|
68
|
+
typeArgs?: string[]
|
|
69
|
+
}): Promise<MoveValue[]> {
|
|
70
|
+
// your implementation
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async sendAndConfirmTransaction(
|
|
74
|
+
sender: MnemonicKey | PrivateKey | MnemonicAndPath,
|
|
75
|
+
func: MoveFunction,
|
|
76
|
+
args: EntryFunctionArgumentTypes[],
|
|
77
|
+
multisig?: string | Uint8Array,
|
|
78
|
+
argTypes?: string[],
|
|
79
|
+
gasOptions?: GasOptions
|
|
80
|
+
): Promise<TransactionResponse> {
|
|
81
|
+
// your implementation
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
async getAccountResource<T extends NonNullable<unknown> = any>(args: {
|
|
85
|
+
accountAddress: string | Uint8Array
|
|
86
|
+
resourceType: MoveStructId
|
|
87
|
+
options?: unknown
|
|
88
|
+
}): Promise<T> {
|
|
89
|
+
// your implementation
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
async getTableItem<T>(args: { handle: string; data: TableItemRequest; options?: unknown }): Promise<T> {
|
|
93
|
+
// your implementation
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
normalizeAddress(address: string): string {
|
|
97
|
+
return address
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
normalizeSigner(signer: MnemonicKey | PrivateKey | MnemonicAndPath): MnemonicKey {
|
|
101
|
+
// your implementation
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
accountToAddress(account: MnemonicKey): string {
|
|
105
|
+
// your implementation
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
supportsCoin(): boolean {
|
|
109
|
+
return false
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Interact with SDK method
|
|
115
|
+
|
|
116
|
+
After you create a SDK instance, you can simply invoke any SDK methods.
|
|
117
|
+
|
|
118
|
+
Here's an example. (Suppose you need to call the **isSetZro** method in Endpoint SDK)
|
|
119
|
+
|
|
120
|
+
```typescript
|
|
121
|
+
const SDK = new SDK();
|
|
122
|
+
const result = await SDK.LayerzeroModule.Endpoint.isSetZro();
|
|
123
|
+
// your remaining implementation
|
|
124
|
+
```
|