@typemove/sui 1.0.2-rc.1 → 1.1.0-rc.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/package.json +5 -5
- package/dist/cjs/utils.d.ts +0 -15
- package/dist/cjs/utils.d.ts.map +0 -1
- package/dist/cjs/utils.js +0 -49
- package/dist/cjs/utils.js.map +0 -1
- package/dist/esm/utils.d.ts +0 -15
- package/dist/esm/utils.d.ts.map +0 -1
- package/dist/esm/utils.js +0 -45
- package/dist/esm/utils.js.map +0 -1
- package/src/utils.ts +0 -62
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typemove/sui",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0-rc.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
],
|
|
31
31
|
"types": "./dist/cjs/index.d.ts",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@mysten/bcs": "^0.7.
|
|
34
|
-
"@mysten/sui.js": "^0.41.
|
|
35
|
-
"chalk": "^5.
|
|
33
|
+
"@mysten/bcs": "^0.7.4",
|
|
34
|
+
"@mysten/sui.js": "^0.41.2",
|
|
35
|
+
"chalk": "^5.3.0",
|
|
36
36
|
"radash": "^11.0.0",
|
|
37
|
-
"@typemove/move": "1.0
|
|
37
|
+
"@typemove/move": "1.1.0-rc.1"
|
|
38
38
|
},
|
|
39
39
|
"url": "https://github.com/sentioxyz/typemove",
|
|
40
40
|
"scripts": {
|
package/dist/cjs/utils.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { SuiTransactionBlockResponse } from '@mysten/sui.js';
|
|
2
|
-
export declare function getMoveCalls(txBlock: SuiTransactionBlockResponse): {
|
|
3
|
-
function: string;
|
|
4
|
-
package: string;
|
|
5
|
-
module: string;
|
|
6
|
-
arguments?: ("GasCoin" | {
|
|
7
|
-
Input: number;
|
|
8
|
-
} | {
|
|
9
|
-
Result: number;
|
|
10
|
-
} | {
|
|
11
|
-
NestedResult: [number, number];
|
|
12
|
-
})[] | undefined;
|
|
13
|
-
type_arguments?: string[] | undefined;
|
|
14
|
-
}[];
|
|
15
|
-
//# sourceMappingURL=utils.d.ts.map
|
package/dist/cjs/utils.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAM5B,MAAM,gBAAgB,CAAA;AAEvB,wBAAgB,YAAY,CAAC,OAAO,EAAE,2BAA2B;;;;;;;;;;;;IA6BhE"}
|
package/dist/cjs/utils.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getMoveCalls = void 0;
|
|
4
|
-
const sui_js_1 = require("@mysten/sui.js");
|
|
5
|
-
function getMoveCalls(txBlock) {
|
|
6
|
-
const txKind = (0, sui_js_1.getTransactionKind)(txBlock);
|
|
7
|
-
if (!txKind) {
|
|
8
|
-
return [];
|
|
9
|
-
}
|
|
10
|
-
const programmableTx = (0, sui_js_1.getProgrammableTransaction)(txKind);
|
|
11
|
-
if (!programmableTx) {
|
|
12
|
-
return [];
|
|
13
|
-
}
|
|
14
|
-
return programmableTx.transactions.flatMap((tx) => {
|
|
15
|
-
if ('MoveCall' in tx) {
|
|
16
|
-
const call = tx.MoveCall;
|
|
17
|
-
let pkg = call.package;
|
|
18
|
-
if (call.package.startsWith('0x000000000000000000000000000000000000000000000000000000000000000')) {
|
|
19
|
-
pkg = '0x' + pkg[pkg.length - 1];
|
|
20
|
-
}
|
|
21
|
-
call.package = pkg;
|
|
22
|
-
return [call];
|
|
23
|
-
}
|
|
24
|
-
return [];
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
exports.getMoveCalls = getMoveCalls;
|
|
28
|
-
// function isHex(value: string): boolean {
|
|
29
|
-
// return /^(0x|0X)?[a-fA-F0-9]+$/.test(value)
|
|
30
|
-
// }
|
|
31
|
-
//
|
|
32
|
-
// function getHexByteLength(value: string): number {
|
|
33
|
-
// return /^(0x|0X)/.test(value) ? (value.length - 2) / 2 : value.length / 2
|
|
34
|
-
// }
|
|
35
|
-
//
|
|
36
|
-
// export function isValidSuiAddress(value: string): value is SuiAddress {
|
|
37
|
-
// return isHex(value) && getHexByteLength(value) <= SUI_ADDRESS_LENGTH
|
|
38
|
-
// }
|
|
39
|
-
// export function validateAndNormalizeAddress(address: string): string {
|
|
40
|
-
// // if (isFrameworkAccount(address)) {
|
|
41
|
-
// // const n = parseInt(address, 16)
|
|
42
|
-
// // return `0x${n.toString(16)}`
|
|
43
|
-
// // }
|
|
44
|
-
// if (!isValidSuiAddress(address)) {
|
|
45
|
-
// throw Error('Not valid Address')
|
|
46
|
-
// }
|
|
47
|
-
// return normalizeSuiAddress(address)
|
|
48
|
-
// }
|
|
49
|
-
//# sourceMappingURL=utils.js.map
|
package/dist/cjs/utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":";;;AAAA,2CAOuB;AAEvB,SAAgB,YAAY,CAAC,OAAoC;IAC/D,MAAM,MAAM,GAAG,IAAA,2BAAkB,EAAC,OAAO,CAAC,CAAA;IAC1C,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,EAAE,CAAA;KACV;IACD,MAAM,cAAc,GAClB,IAAA,mCAA0B,EAAC,MAAM,CAAC,CAAA;IACpC,IAAI,CAAC,cAAc,EAAE;QACnB,OAAO,EAAE,CAAA;KACV;IAED,OAAO,cAAc,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,EAAkB,EAAE,EAAE;QAChE,IAAI,UAAU,IAAI,EAAE,EAAE;YACpB,MAAM,IAAI,GAAG,EAAE,CAAC,QAAkC,CAAA;YAElD,IAAI,GAAG,GAAW,IAAI,CAAC,OAAO,CAAA;YAC9B,IACE,IAAI,CAAC,OAAO,CAAC,UAAU,CACrB,mEAAmE,CACpE,EACD;gBACA,GAAG,GAAG,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;aACjC;YACD,IAAI,CAAC,OAAO,GAAG,GAAG,CAAA;YAElB,OAAO,CAAC,IAAI,CAAC,CAAA;SACd;QACD,OAAO,EAAE,CAAA;IACX,CAAC,CAAC,CAAA;AACJ,CAAC;AA7BD,oCA6BC;AAED,2CAA2C;AAC3C,gDAAgD;AAChD,IAAI;AACJ,EAAE;AACF,qDAAqD;AACrD,8EAA8E;AAC9E,IAAI;AACJ,EAAE;AACF,0EAA0E;AAC1E,yEAAyE;AACzE,IAAI;AAEJ,yEAAyE;AACzE,0CAA0C;AAC1C,yCAAyC;AACzC,sCAAsC;AACtC,SAAS;AACT,uCAAuC;AACvC,uCAAuC;AACvC,MAAM;AACN,wCAAwC;AACxC,IAAI"}
|
package/dist/esm/utils.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { SuiTransactionBlockResponse } from '@mysten/sui.js';
|
|
2
|
-
export declare function getMoveCalls(txBlock: SuiTransactionBlockResponse): {
|
|
3
|
-
function: string;
|
|
4
|
-
package: string;
|
|
5
|
-
module: string;
|
|
6
|
-
arguments?: ("GasCoin" | {
|
|
7
|
-
Input: number;
|
|
8
|
-
} | {
|
|
9
|
-
Result: number;
|
|
10
|
-
} | {
|
|
11
|
-
NestedResult: [number, number];
|
|
12
|
-
})[] | undefined;
|
|
13
|
-
type_arguments?: string[] | undefined;
|
|
14
|
-
}[];
|
|
15
|
-
//# sourceMappingURL=utils.d.ts.map
|
package/dist/esm/utils.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAM5B,MAAM,gBAAgB,CAAA;AAEvB,wBAAgB,YAAY,CAAC,OAAO,EAAE,2BAA2B;;;;;;;;;;;;IA6BhE"}
|
package/dist/esm/utils.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { getTransactionKind, getProgrammableTransaction, } from '@mysten/sui.js';
|
|
2
|
-
export function getMoveCalls(txBlock) {
|
|
3
|
-
const txKind = getTransactionKind(txBlock);
|
|
4
|
-
if (!txKind) {
|
|
5
|
-
return [];
|
|
6
|
-
}
|
|
7
|
-
const programmableTx = getProgrammableTransaction(txKind);
|
|
8
|
-
if (!programmableTx) {
|
|
9
|
-
return [];
|
|
10
|
-
}
|
|
11
|
-
return programmableTx.transactions.flatMap((tx) => {
|
|
12
|
-
if ('MoveCall' in tx) {
|
|
13
|
-
const call = tx.MoveCall;
|
|
14
|
-
let pkg = call.package;
|
|
15
|
-
if (call.package.startsWith('0x000000000000000000000000000000000000000000000000000000000000000')) {
|
|
16
|
-
pkg = '0x' + pkg[pkg.length - 1];
|
|
17
|
-
}
|
|
18
|
-
call.package = pkg;
|
|
19
|
-
return [call];
|
|
20
|
-
}
|
|
21
|
-
return [];
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
// function isHex(value: string): boolean {
|
|
25
|
-
// return /^(0x|0X)?[a-fA-F0-9]+$/.test(value)
|
|
26
|
-
// }
|
|
27
|
-
//
|
|
28
|
-
// function getHexByteLength(value: string): number {
|
|
29
|
-
// return /^(0x|0X)/.test(value) ? (value.length - 2) / 2 : value.length / 2
|
|
30
|
-
// }
|
|
31
|
-
//
|
|
32
|
-
// export function isValidSuiAddress(value: string): value is SuiAddress {
|
|
33
|
-
// return isHex(value) && getHexByteLength(value) <= SUI_ADDRESS_LENGTH
|
|
34
|
-
// }
|
|
35
|
-
// export function validateAndNormalizeAddress(address: string): string {
|
|
36
|
-
// // if (isFrameworkAccount(address)) {
|
|
37
|
-
// // const n = parseInt(address, 16)
|
|
38
|
-
// // return `0x${n.toString(16)}`
|
|
39
|
-
// // }
|
|
40
|
-
// if (!isValidSuiAddress(address)) {
|
|
41
|
-
// throw Error('Not valid Address')
|
|
42
|
-
// }
|
|
43
|
-
// return normalizeSuiAddress(address)
|
|
44
|
-
// }
|
|
45
|
-
//# sourceMappingURL=utils.js.map
|
package/dist/esm/utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,kBAAkB,EAClB,0BAA0B,GAG3B,MAAM,gBAAgB,CAAA;AAEvB,MAAM,UAAU,YAAY,CAAC,OAAoC;IAC/D,MAAM,MAAM,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAA;IAC1C,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,EAAE,CAAA;KACV;IACD,MAAM,cAAc,GAClB,0BAA0B,CAAC,MAAM,CAAC,CAAA;IACpC,IAAI,CAAC,cAAc,EAAE;QACnB,OAAO,EAAE,CAAA;KACV;IAED,OAAO,cAAc,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,EAAkB,EAAE,EAAE;QAChE,IAAI,UAAU,IAAI,EAAE,EAAE;YACpB,MAAM,IAAI,GAAG,EAAE,CAAC,QAAkC,CAAA;YAElD,IAAI,GAAG,GAAW,IAAI,CAAC,OAAO,CAAA;YAC9B,IACE,IAAI,CAAC,OAAO,CAAC,UAAU,CACrB,mEAAmE,CACpE,EACD;gBACA,GAAG,GAAG,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;aACjC;YACD,IAAI,CAAC,OAAO,GAAG,GAAG,CAAA;YAElB,OAAO,CAAC,IAAI,CAAC,CAAA;SACd;QACD,OAAO,EAAE,CAAA;IACX,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,2CAA2C;AAC3C,gDAAgD;AAChD,IAAI;AACJ,EAAE;AACF,qDAAqD;AACrD,8EAA8E;AAC9E,IAAI;AACJ,EAAE;AACF,0EAA0E;AAC1E,yEAAyE;AACzE,IAAI;AAEJ,yEAAyE;AACzE,0CAA0C;AAC1C,yCAAyC;AACzC,sCAAsC;AACtC,SAAS;AACT,uCAAuC;AACvC,uCAAuC;AACvC,MAAM;AACN,wCAAwC;AACxC,IAAI"}
|
package/src/utils.ts
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
SuiTransactionBlockResponse,
|
|
3
|
-
MoveCallSuiTransaction,
|
|
4
|
-
getTransactionKind,
|
|
5
|
-
getProgrammableTransaction,
|
|
6
|
-
ProgrammableTransaction,
|
|
7
|
-
SuiTransaction,
|
|
8
|
-
} from '@mysten/sui.js'
|
|
9
|
-
|
|
10
|
-
export function getMoveCalls(txBlock: SuiTransactionBlockResponse) {
|
|
11
|
-
const txKind = getTransactionKind(txBlock)
|
|
12
|
-
if (!txKind) {
|
|
13
|
-
return []
|
|
14
|
-
}
|
|
15
|
-
const programmableTx: ProgrammableTransaction | undefined =
|
|
16
|
-
getProgrammableTransaction(txKind)
|
|
17
|
-
if (!programmableTx) {
|
|
18
|
-
return []
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return programmableTx.transactions.flatMap((tx: SuiTransaction) => {
|
|
22
|
-
if ('MoveCall' in tx) {
|
|
23
|
-
const call = tx.MoveCall as MoveCallSuiTransaction
|
|
24
|
-
|
|
25
|
-
let pkg: string = call.package
|
|
26
|
-
if (
|
|
27
|
-
call.package.startsWith(
|
|
28
|
-
'0x000000000000000000000000000000000000000000000000000000000000000'
|
|
29
|
-
)
|
|
30
|
-
) {
|
|
31
|
-
pkg = '0x' + pkg[pkg.length - 1]
|
|
32
|
-
}
|
|
33
|
-
call.package = pkg
|
|
34
|
-
|
|
35
|
-
return [call]
|
|
36
|
-
}
|
|
37
|
-
return []
|
|
38
|
-
})
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// function isHex(value: string): boolean {
|
|
42
|
-
// return /^(0x|0X)?[a-fA-F0-9]+$/.test(value)
|
|
43
|
-
// }
|
|
44
|
-
//
|
|
45
|
-
// function getHexByteLength(value: string): number {
|
|
46
|
-
// return /^(0x|0X)/.test(value) ? (value.length - 2) / 2 : value.length / 2
|
|
47
|
-
// }
|
|
48
|
-
//
|
|
49
|
-
// export function isValidSuiAddress(value: string): value is SuiAddress {
|
|
50
|
-
// return isHex(value) && getHexByteLength(value) <= SUI_ADDRESS_LENGTH
|
|
51
|
-
// }
|
|
52
|
-
|
|
53
|
-
// export function validateAndNormalizeAddress(address: string): string {
|
|
54
|
-
// // if (isFrameworkAccount(address)) {
|
|
55
|
-
// // const n = parseInt(address, 16)
|
|
56
|
-
// // return `0x${n.toString(16)}`
|
|
57
|
-
// // }
|
|
58
|
-
// if (!isValidSuiAddress(address)) {
|
|
59
|
-
// throw Error('Not valid Address')
|
|
60
|
-
// }
|
|
61
|
-
// return normalizeSuiAddress(address)
|
|
62
|
-
// }
|