@msafe/sui-app-store 0.0.127 → 0.0.128

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
@@ -32,30 +32,67 @@ We provide a demo dApp for MSafe app store integration. please refer below GitHu
32
32
 
33
33
  Here is an example for transaction intention, if your dapp have multiple transaction types, you need to define 1 by 1 for each type of transaction intention.
34
34
 
35
+ If you are using @mysten/sui.js, you can refer to the following code:
36
+
35
37
  ```typescript
38
+ import { SuiClient } from '@mysten/sui.js/client';
39
+ import { TransactionBlock } from '@mysten/sui.js/transactions';
36
40
 
37
- export interface CoinTransferIntentionData {
38
- recipient: string;
39
- coinType: string;
40
- amount: string;
41
+ export interface ExampleIntentionData {
42
+ foo: string;
43
+ bar: string;
41
44
  }
42
45
 
43
- export class CoinTransferIntention extends CoreBaseIntention<CoinTransferIntentionData> {
44
- txType: TransactionType.Assets;
46
+ export class ExampleIntention extends BaseIntentionLegacy<ExampleIntentionData> {
47
+ txType: TransactionType.Other;
45
48
 
46
- txSubType: 'SendCoin';
49
+ txSubType: 'Example';
47
50
 
48
- constructor(public readonly data: CoinTransferIntentionData) {
51
+ constructor(public readonly data: ExampleIntentionData) {
49
52
  super(data);
50
53
  }
51
54
 
52
55
  async build(input: { suiClient: SuiClient; account: WalletAccount }): Promise<TransactionBlock> {
53
56
  const { suiClient, account } = input;
54
- return buildCoinTransferTxb(suiClient, this.data, account.address);
57
+ ...
58
+ return txb;
59
+ }
60
+
61
+ static fromData(data: ExampleIntentionData) {
62
+ return new ExampleIntention(data);
63
+ }
64
+ }
65
+ ```
66
+
67
+
68
+ If you are using @mysten/sui, you can refer to the following code:
69
+
70
+ ```typescript
71
+ import { SuiClient } from '@mysten/sui/client';
72
+ import { Transaction } from '@mysten/sui/transactions';
73
+
74
+ export interface ExampleIntentionData {
75
+ foo: string;
76
+ bar: string;
77
+ }
78
+
79
+ export class ExampleIntention extends BaseIntention<ExampleIntentionData> {
80
+ txType: TransactionType.Other;
81
+
82
+ txSubType: 'Example';
83
+
84
+ constructor(public readonly data: ExampleIntentionData) {
85
+ super(data);
86
+ }
87
+
88
+ async build(input: { suiClient: SuiClient; account: WalletAccount }): Promise<Transaction> {
89
+ const { suiClient, account } = input;
90
+ ...
91
+ return txb;
55
92
  }
56
93
 
57
- static fromData(data: CoinTransferIntentionData) {
58
- return new CoinTransferIntention(data);
94
+ static fromData(data: ExampleIntentionData) {
95
+ return new ExampleIntention(data);
59
96
  }
60
97
  }
61
98
  ```
package/dist/index.d.mts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { TransactionType } from '@msafe/sui3-utils';
2
- import { SuiClient as SuiClient$1 } from '@mysten/sui/client';
3
- import { Transaction } from '@mysten/sui/transactions';
4
- import { SuiClient } from '@mysten/sui.js/client';
5
2
  import { TransactionBlock } from '@mysten/sui.js/transactions';
6
3
  import { SuiSignTransactionBlockInput, WalletAccount, IdentifierString } from '@mysten/wallet-standard';
4
+ import { SuiClient } from '@mysten/sui/client';
5
+ import { Transaction } from '@mysten/sui/transactions';
6
+ import { SuiClient as SuiClient$1 } from '@mysten/sui.js/client';
7
7
 
8
8
  type SuiNetworks = 'sui:devnet' | 'sui:testnet' | 'sui:localnet' | 'sui:mainnet';
9
9
 
@@ -27,10 +27,13 @@ interface IAppHelper<T> {
27
27
  account: WalletAccount;
28
28
  }): Promise<TransactionBlock>;
29
29
  }
30
- interface IAppHelperInternalLegacy<T> {
30
+
31
+ interface IAppHelperInternal<T> {
31
32
  application: string;
32
- supportSDK: '@mysten/sui.js';
33
- deserialize(input: SuiSignTransactionBlockInput & {
33
+ supportSDK: '@mysten/sui';
34
+ deserialize(input: {
35
+ transaction: Transaction;
36
+ chain: IdentifierString;
34
37
  network: SuiNetworks;
35
38
  suiClient: SuiClient;
36
39
  account: WalletAccount;
@@ -46,14 +49,13 @@ interface IAppHelperInternalLegacy<T> {
46
49
  intentionData: T;
47
50
  suiClient: SuiClient;
48
51
  account: WalletAccount;
49
- }): Promise<TransactionBlock>;
52
+ }): Promise<Transaction>;
50
53
  }
51
- interface IAppHelperInternal<T> {
54
+
55
+ interface IAppHelperInternalLegacy<T> {
52
56
  application: string;
53
- supportSDK: '@mysten/sui';
54
- deserialize(input: {
55
- transaction: Transaction;
56
- chain: IdentifierString;
57
+ supportSDK: '@mysten/sui.js';
58
+ deserialize(input: SuiSignTransactionBlockInput & {
57
59
  network: SuiNetworks;
58
60
  suiClient: SuiClient$1;
59
61
  account: WalletAccount;
@@ -69,7 +71,7 @@ interface IAppHelperInternal<T> {
69
71
  intentionData: T;
70
72
  suiClient: SuiClient$1;
71
73
  account: WalletAccount;
72
- }): Promise<Transaction>;
74
+ }): Promise<TransactionBlock>;
73
75
  }
74
76
 
75
77
  declare class MSafeApps {
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { TransactionType } from '@msafe/sui3-utils';
2
- import { SuiClient as SuiClient$1 } from '@mysten/sui/client';
3
- import { Transaction } from '@mysten/sui/transactions';
4
- import { SuiClient } from '@mysten/sui.js/client';
5
2
  import { TransactionBlock } from '@mysten/sui.js/transactions';
6
3
  import { SuiSignTransactionBlockInput, WalletAccount, IdentifierString } from '@mysten/wallet-standard';
4
+ import { SuiClient } from '@mysten/sui/client';
5
+ import { Transaction } from '@mysten/sui/transactions';
6
+ import { SuiClient as SuiClient$1 } from '@mysten/sui.js/client';
7
7
 
8
8
  type SuiNetworks = 'sui:devnet' | 'sui:testnet' | 'sui:localnet' | 'sui:mainnet';
9
9
 
@@ -27,10 +27,13 @@ interface IAppHelper<T> {
27
27
  account: WalletAccount;
28
28
  }): Promise<TransactionBlock>;
29
29
  }
30
- interface IAppHelperInternalLegacy<T> {
30
+
31
+ interface IAppHelperInternal<T> {
31
32
  application: string;
32
- supportSDK: '@mysten/sui.js';
33
- deserialize(input: SuiSignTransactionBlockInput & {
33
+ supportSDK: '@mysten/sui';
34
+ deserialize(input: {
35
+ transaction: Transaction;
36
+ chain: IdentifierString;
34
37
  network: SuiNetworks;
35
38
  suiClient: SuiClient;
36
39
  account: WalletAccount;
@@ -46,14 +49,13 @@ interface IAppHelperInternalLegacy<T> {
46
49
  intentionData: T;
47
50
  suiClient: SuiClient;
48
51
  account: WalletAccount;
49
- }): Promise<TransactionBlock>;
52
+ }): Promise<Transaction>;
50
53
  }
51
- interface IAppHelperInternal<T> {
54
+
55
+ interface IAppHelperInternalLegacy<T> {
52
56
  application: string;
53
- supportSDK: '@mysten/sui';
54
- deserialize(input: {
55
- transaction: Transaction;
56
- chain: IdentifierString;
57
+ supportSDK: '@mysten/sui.js';
58
+ deserialize(input: SuiSignTransactionBlockInput & {
57
59
  network: SuiNetworks;
58
60
  suiClient: SuiClient$1;
59
61
  account: WalletAccount;
@@ -69,7 +71,7 @@ interface IAppHelperInternal<T> {
69
71
  intentionData: T;
70
72
  suiClient: SuiClient$1;
71
73
  account: WalletAccount;
72
- }): Promise<Transaction>;
74
+ }): Promise<TransactionBlock>;
73
75
  }
74
76
 
75
77
  declare class MSafeApps {