@msafe/sui-app-store 0.0.3 → 0.0.5
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/dist/index.cjs +23 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +15 -14
- package/dist/index.global.js +4 -4
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +28 -25
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,36 +1,39 @@
|
|
|
1
|
-
// src/app/
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
coinType: "0x2::sui::SUI"
|
|
13
|
-
}
|
|
14
|
-
};
|
|
1
|
+
// src/app/msafe.ts
|
|
2
|
+
import {
|
|
3
|
+
TransactionSubTypes,
|
|
4
|
+
buildCoinTransferTxb,
|
|
5
|
+
buildObjectTransferTxb
|
|
6
|
+
} from "@msafe/sui3-utils";
|
|
7
|
+
var MSafeCoreWallet = class {
|
|
8
|
+
async deserialize(input) {
|
|
9
|
+
throw new Error(
|
|
10
|
+
"MSafe core transaction intention should be build from API"
|
|
11
|
+
);
|
|
15
12
|
}
|
|
16
13
|
async build(input) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
14
|
+
const { transactionIntention, context } = input;
|
|
15
|
+
switch (transactionIntention.txSubType) {
|
|
16
|
+
case TransactionSubTypes.assets.coin.send:
|
|
17
|
+
return buildCoinTransferTxb(
|
|
18
|
+
context.suiClient,
|
|
19
|
+
transactionIntention.data,
|
|
20
|
+
context.account.address
|
|
21
|
+
);
|
|
22
|
+
case TransactionSubTypes.assets.object.send:
|
|
23
|
+
return buildObjectTransferTxb(
|
|
24
|
+
context.suiClient,
|
|
25
|
+
transactionIntention.data,
|
|
26
|
+
context.account.address
|
|
27
|
+
);
|
|
28
|
+
default:
|
|
29
|
+
throw new Error("Unsupported transaction type");
|
|
26
30
|
}
|
|
27
|
-
throw new Error("Method not implemented.");
|
|
28
31
|
}
|
|
29
32
|
};
|
|
30
33
|
|
|
31
34
|
// src/index.ts
|
|
32
35
|
var MSafeApps = class {
|
|
33
|
-
|
|
36
|
+
msafeCore = new MSafeCoreWallet();
|
|
34
37
|
};
|
|
35
38
|
export {
|
|
36
39
|
MSafeApps
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/app/
|
|
1
|
+
{"version":3,"sources":["../src/app/msafe.ts","../src/index.ts"],"sourcesContent":["import {\n MSafeWalletApi,\n MSafeWalletContext,\n TransactionIntention,\n TransactionIntentions,\n} from \"@/index\";\nimport {\n CoinTransferIntention,\n ObjectTransferIntention,\n TransactionSubTypes,\n buildCoinTransferTxb,\n buildObjectTransferTxb,\n} from \"@msafe/sui3-utils\";\nimport { TransactionBlock } from \"@mysten/sui.js/transactions\";\nimport { SuiSignTransactionBlockInput } from \"@mysten/wallet-standard\";\n\nexport class MSafeCoreWallet implements MSafeWalletApi {\n async deserialize(\n input: SuiSignTransactionBlockInput\n ): Promise<TransactionIntention<keyof TransactionIntentions>> {\n throw new Error(\n \"MSafe core transaction intention should be build from API\"\n );\n }\n async build(input: {\n transactionIntention: TransactionIntention<keyof TransactionIntentions>;\n context: MSafeWalletContext;\n }): Promise<TransactionBlock> {\n const { transactionIntention, context } = input;\n switch (transactionIntention.txSubType) {\n case TransactionSubTypes.assets.coin.send:\n return buildCoinTransferTxb(\n context.suiClient,\n transactionIntention.data as CoinTransferIntention,\n context.account.address\n );\n case TransactionSubTypes.assets.object.send:\n return buildObjectTransferTxb(\n context.suiClient,\n transactionIntention.data as ObjectTransferIntention,\n context.account.address\n );\n default:\n throw new Error(\"Unsupported transaction type\");\n }\n }\n}\n","import {\n CoinTransferIntention,\n ObjectTransferIntention,\n TransactionType,\n} from \"@msafe/sui3-utils\";\nimport { SuiClient } from \"@mysten/sui.js/client\";\nimport { TransactionBlock } from \"@mysten/sui.js/transactions\";\nimport {\n SuiSignTransactionBlockInput,\n WalletAccount,\n} from \"@mysten/wallet-standard\";\nimport { MSafeCoreWallet } from \"./app/msafe\";\n\nexport interface MSafeWalletApi {\n /**\n * Deserialize transaction block data to human readable data structure.\n * @param input transaction block input\n */\n deserialize(\n input: SuiSignTransactionBlockInput\n ): Promise<TransactionIntention<keyof TransactionIntentions>>;\n\n build(input: {\n transactionIntention: TransactionIntention<keyof TransactionIntentions>;\n context: MSafeWalletContext;\n }): Promise<TransactionBlock>;\n}\n\nexport interface MSafeWalletContext {\n suiClient: SuiClient;\n account: WalletAccount;\n}\n\nexport interface TransactionIntention<T extends keyof TransactionIntentions> {\n txType: TransactionType;\n txSubType: T;\n data: TransactionIntentions[T];\n}\n\n/**\n * Support transaction intention data structure.\n * App need to add your transaction intention types here\n */\nexport interface TransactionIntentions {\n CoinTransfer: CoinTransferIntention;\n ObjectTransfer: ObjectTransferIntention;\n}\n\nexport class MSafeApps {\n public msafeCore = new MSafeCoreWallet();\n}\n"],"mappings":";AAMA;AAAA,EAGE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAIA,IAAM,kBAAN,MAAgD;AAAA,EACrD,MAAM,YACJ,OAC4D;AAC5D,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAAA,EACA,MAAM,MAAM,OAGkB;AAC5B,UAAM,EAAE,sBAAsB,QAAQ,IAAI;AAC1C,YAAQ,qBAAqB,WAAW;AAAA,MACtC,KAAK,oBAAoB,OAAO,KAAK;AACnC,eAAO;AAAA,UACL,QAAQ;AAAA,UACR,qBAAqB;AAAA,UACrB,QAAQ,QAAQ;AAAA,QAClB;AAAA,MACF,KAAK,oBAAoB,OAAO,OAAO;AACrC,eAAO;AAAA,UACL,QAAQ;AAAA,UACR,qBAAqB;AAAA,UACrB,QAAQ,QAAQ;AAAA,QAClB;AAAA,MACF;AACE,cAAM,IAAI,MAAM,8BAA8B;AAAA,IAClD;AAAA,EACF;AACF;;;ACEO,IAAM,YAAN,MAAgB;AAAA,EACd,YAAY,IAAI,gBAAgB;AACzC;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@msafe/sui-app-store",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "MSafe Sui app store repository",
|
|
5
5
|
"author": "Momentum Safe",
|
|
6
6
|
"license": "MIT",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"buffer": "^6.0.3"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@msafe/sui3-utils": "^3.1.
|
|
51
|
+
"@msafe/sui3-utils": "^3.1.18",
|
|
52
52
|
"@mysten/sui.js": "^0.49.1",
|
|
53
53
|
"@mysten/wallet-standard": "^0.10.1",
|
|
54
54
|
"@types/jest": "^29.2.1",
|