@msafe/sui-app-store 0.0.3

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.js ADDED
@@ -0,0 +1,38 @@
1
+ // src/app/example.ts
2
+ import { TransactionType } from "@msafe/sui3-utils";
3
+ import { TransactionBlock } from "@mysten/sui.js/transactions";
4
+ var ExampleWallet = class {
5
+ async deserilize(input) {
6
+ return {
7
+ txType: TransactionType.Assets,
8
+ txSubType: "CoinTransfer",
9
+ data: {
10
+ recipient: input.account.address,
11
+ amount: "10000",
12
+ coinType: "0x2::sui::SUI"
13
+ }
14
+ };
15
+ }
16
+ async build(input) {
17
+ if (input.transactionIntention.txSubType === "CoinTransfer") {
18
+ const intention = input.transactionIntention.data;
19
+ const block = new TransactionBlock();
20
+ const [coin] = block.splitCoins(block.gas, [
21
+ block.pure(intention.amount)
22
+ ]);
23
+ block.transferObjects([coin], block.pure(intention.recipient));
24
+ block.setSender(input.account.address);
25
+ return block;
26
+ }
27
+ throw new Error("Method not implemented.");
28
+ }
29
+ };
30
+
31
+ // src/index.ts
32
+ var MSafeApps = class {
33
+ example = new ExampleWallet();
34
+ };
35
+ export {
36
+ MSafeApps
37
+ };
38
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/app/example.ts","../src/index.ts"],"sourcesContent":["import { TransactionType } from \"@msafe/sui3-utils\";\nimport { TransactionBlock } from \"@mysten/sui.js/transactions\";\nimport {\n SuiSignTransactionBlockInput,\n WalletAccount,\n} from \"@mysten/wallet-standard\";\nimport {\n MSafeWalletApi,\n TransactionIntention,\n TransactionIntentions,\n} from \"..\";\n\nexport interface CoinTransferIntention {\n recipient: string;\n coinType: string;\n amount: string;\n}\n\nexport class ExampleWallet implements MSafeWalletApi {\n async deserilize(\n input: SuiSignTransactionBlockInput\n ): Promise<TransactionIntention<keyof TransactionIntentions>> {\n return {\n txType: TransactionType.Assets,\n txSubType: \"CoinTransfer\",\n data: {\n recipient: input.account.address,\n amount: \"10000\",\n coinType: \"0x2::sui::SUI\",\n },\n };\n }\n async build(input: {\n transactionIntention: TransactionIntention<keyof TransactionIntentions>;\n account: WalletAccount;\n }): Promise<TransactionBlock> {\n if (input.transactionIntention.txSubType === \"CoinTransfer\") {\n const intention = input.transactionIntention\n .data as CoinTransferIntention;\n const block = new TransactionBlock();\n const [coin] = block.splitCoins(block.gas, [\n block.pure(intention.amount),\n ]);\n block.transferObjects([coin], block.pure(intention.recipient));\n block.setSender(input.account.address);\n return block;\n }\n throw new Error(\"Method not implemented.\");\n }\n}\n","import { TransactionType } from \"@msafe/sui3-utils\";\nimport { TransactionBlock } from \"@mysten/sui.js/transactions\";\nimport {\n SuiSignTransactionBlockInput,\n WalletAccount,\n} from \"@mysten/wallet-standard\";\nimport { CoinTransferIntention, ExampleWallet } from \"./app/example\";\n\nexport interface MSafeWalletApi {\n /**\n * Deserilize transaction block data to human readable data struccture.\n * @param input transaction block input\n */\n deserilize(\n input: SuiSignTransactionBlockInput\n ): Promise<TransactionIntention<keyof TransactionIntentions>>;\n\n build(input: {\n transactionIntention: TransactionIntention<keyof TransactionIntentions>;\n account: WalletAccount;\n }): Promise<TransactionBlock>;\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}\n\nexport class MSafeApps {\n public example = new ExampleWallet();\n}\n"],"mappings":";AAAA,SAAS,uBAAuB;AAChC,SAAS,wBAAwB;AAiB1B,IAAM,gBAAN,MAA8C;AAAA,EACnD,MAAM,WACJ,OAC4D;AAC5D,WAAO;AAAA,MACL,QAAQ,gBAAgB;AAAA,MACxB,WAAW;AAAA,MACX,MAAM;AAAA,QACJ,WAAW,MAAM,QAAQ;AAAA,QACzB,QAAQ;AAAA,QACR,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAAA,EACA,MAAM,MAAM,OAGkB;AAC5B,QAAI,MAAM,qBAAqB,cAAc,gBAAgB;AAC3D,YAAM,YAAY,MAAM,qBACrB;AACH,YAAM,QAAQ,IAAI,iBAAiB;AACnC,YAAM,CAAC,IAAI,IAAI,MAAM,WAAW,MAAM,KAAK;AAAA,QACzC,MAAM,KAAK,UAAU,MAAM;AAAA,MAC7B,CAAC;AACD,YAAM,gBAAgB,CAAC,IAAI,GAAG,MAAM,KAAK,UAAU,SAAS,CAAC;AAC7D,YAAM,UAAU,MAAM,QAAQ,OAAO;AACrC,aAAO;AAAA,IACT;AACA,UAAM,IAAI,MAAM,yBAAyB;AAAA,EAC3C;AACF;;;ACZO,IAAM,YAAN,MAAgB;AAAA,EACd,UAAU,IAAI,cAAc;AACrC;","names":[]}
package/package.json ADDED
@@ -0,0 +1,70 @@
1
+ {
2
+ "name": "@msafe/sui-app-store",
3
+ "version": "0.0.3",
4
+ "description": "MSafe Sui app store repository",
5
+ "author": "Momentum Safe",
6
+ "license": "MIT",
7
+ "type": "module",
8
+ "private": false,
9
+ "main": "./dist/index.js",
10
+ "module": "./dist/index.cjs",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/index.d.ts",
14
+ "source": "./src/index.ts",
15
+ "import": "./dist/index.js",
16
+ "require": "./dist/index.cjs"
17
+ }
18
+ },
19
+ "files": [
20
+ "dist/**/*",
21
+ "package.json"
22
+ ],
23
+ "scripts": {
24
+ "clean": "rm -rf ./dist",
25
+ "build": "yarn clean && yarn _build:browser && yarn _build:node",
26
+ "build-yalc": "yarn build && yalc publish --private",
27
+ "_build:browser": "tsup --platform browser --format iife --global-name MSafeWallet --minify",
28
+ "_build:node": "tsup --format cjs,esm --dts",
29
+ "test": "jest",
30
+ "coverage": "jest --coverage"
31
+ },
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "https://github.com/Momentum-Safe/msafe-sui-wallet.git"
35
+ },
36
+ "homepage": "https://github.com/Momentum-Safe/msafe-sui-wallet",
37
+ "bugs": {
38
+ "url": "https://github.com/Momentum-Safe/msafe-sui-wallet/issues"
39
+ },
40
+ "keywords": [
41
+ "MSafe",
42
+ "MSafe Iframe",
43
+ "MSafe SDK",
44
+ "MSafe wallet",
45
+ "MSafe Sui"
46
+ ],
47
+ "dependencies": {
48
+ "buffer": "^6.0.3"
49
+ },
50
+ "devDependencies": {
51
+ "@msafe/sui3-utils": "^3.1.9",
52
+ "@mysten/sui.js": "^0.49.1",
53
+ "@mysten/wallet-standard": "^0.10.1",
54
+ "@types/jest": "^29.2.1",
55
+ "@typescript-eslint/eslint-plugin": "^5.41.0",
56
+ "@typescript-eslint/parser": "^5.41.0",
57
+ "eslint": "^8.26.0",
58
+ "eslint-plugin-node": "^11.1.0",
59
+ "jest": "^29.2.2",
60
+ "ts-jest": "^29.0.3",
61
+ "ts-node": "^10.9.2",
62
+ "tsup": "^6.5.0",
63
+ "typescript": "^4.8.4"
64
+ },
65
+ "peerDependencies": {
66
+ "@msafe/sui3-utils": "^3.1.6",
67
+ "@mysten/sui.js": "^0.49.1",
68
+ "@mysten/wallet-standard": "^0.10.1"
69
+ }
70
+ }