@msafe/sui-app-store 0.0.145 → 0.0.147

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -196,6 +196,58 @@ describe('MSafe Core Wallet', () => {
196
196
  });
197
197
  ```
198
198
 
199
+ ### App custom parameters
200
+
201
+ - You can pass custom parameters into the `appContext` parameter of the Helper.deserialize method.
202
+
203
+ ```typescript
204
+ deserialize(input: {
205
+ transaction: Transaction;
206
+ chain: IdentifierString;
207
+ network: SuiNetworks;
208
+ suiClient: SuiClient;
209
+ account: WalletAccount;
210
+ appContext?: any;
211
+ }): Promise<{
212
+ txType: TransactionType;
213
+ txSubType: string;
214
+ intentionData: T;
215
+ }>;
216
+ ```
217
+
218
+ - When implementing your app's `Helper.deserialize`, you can write your business logic based on the custom parameters you've passed in.
219
+
220
+ - For reference, you can review the implementation logic demo code below.
221
+
222
+ ```typescript
223
+ export class DemoHelper implements IAppHelperInternal<DemoIntentionData> {
224
+
225
+ ...
226
+
227
+ async deserialize(input: {
228
+ transaction: Transaction;
229
+ chain: IdentifierString;
230
+ network: SuiNetworks;
231
+ suiClient: SuiClient;
232
+ account: WalletAccount;
233
+ appContext?: any;
234
+ }): Promise<{ txType: TransactionType; txSubType: string; intentionData: CetusIntentionData }> {
235
+ const { txbParams, action } = input.appContext;
236
+
237
+ return {
238
+ txType: TransactionType.Other,
239
+ txSubType: action,
240
+ intentionData: {
241
+ txbParams: { ...txbParams },
242
+ action,
243
+ },
244
+ };
245
+ }
246
+
247
+ ...
248
+
249
+ ```
250
+
199
251
  ### Register your app helper
200
252
 
201
253
  - Add your app helper to file `src/index.ts`
package/dist/index.d.mts CHANGED
@@ -12,6 +12,7 @@ interface IAppHelper<T> {
12
12
  network: SuiNetworks;
13
13
  clientUrl: string;
14
14
  account: WalletAccount;
15
+ appContext?: any;
15
16
  }): Promise<{
16
17
  txType: TransactionType;
17
18
  txSubType: string;
@@ -36,6 +37,7 @@ interface IAppHelperInternal<T> {
36
37
  network: SuiNetworks;
37
38
  suiClient: SuiClient;
38
39
  account: WalletAccount;
40
+ appContext?: any;
39
41
  }): Promise<{
40
42
  txType: TransactionType;
41
43
  txSubType: string;
package/dist/index.d.ts CHANGED
@@ -12,6 +12,7 @@ interface IAppHelper<T> {
12
12
  network: SuiNetworks;
13
13
  clientUrl: string;
14
14
  account: WalletAccount;
15
+ appContext?: any;
15
16
  }): Promise<{
16
17
  txType: TransactionType;
17
18
  txSubType: string;
@@ -36,6 +37,7 @@ interface IAppHelperInternal<T> {
36
37
  network: SuiNetworks;
37
38
  suiClient: SuiClient;
38
39
  account: WalletAccount;
40
+ appContext?: any;
39
41
  }): Promise<{
40
42
  txType: TransactionType;
41
43
  txSubType: string;