@typemove/iota 1.14.0-rc.1 → 2.0.0
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 +3 -3
- package/dist/esm/builtin/0x1.d.ts +0 -733
- package/dist/esm/builtin/0x1.d.ts.map +0 -1
- package/dist/esm/builtin/0x1.js +0 -4293
- package/dist/esm/builtin/0x1.js.map +0 -1
- package/dist/esm/builtin/0x2.d.ts +0 -4607
- package/dist/esm/builtin/0x2.d.ts.map +0 -1
- package/dist/esm/builtin/0x2.js +0 -19016
- package/dist/esm/builtin/0x2.js.map +0 -1
- package/dist/esm/builtin/0x3.d.ts +0 -1901
- package/dist/esm/builtin/0x3.d.ts.map +0 -1
- package/dist/esm/builtin/0x3.js +0 -6165
- package/dist/esm/builtin/0x3.js.map +0 -1
- package/dist/esm/builtin/index.d.ts +0 -4
- package/dist/esm/builtin/index.d.ts.map +0 -1
- package/dist/esm/builtin/index.js +0 -7
- package/dist/esm/builtin/index.js.map +0 -1
- package/dist/esm/codegen/codegen.d.ts +0 -20
- package/dist/esm/codegen/codegen.d.ts.map +0 -1
- package/dist/esm/codegen/codegen.js +0 -245
- package/dist/esm/codegen/codegen.js.map +0 -1
- package/dist/esm/codegen/index.d.ts +0 -2
- package/dist/esm/codegen/index.d.ts.map +0 -1
- package/dist/esm/codegen/index.js +0 -2
- package/dist/esm/codegen/index.js.map +0 -1
- package/dist/esm/codegen/run.d.ts +0 -3
- package/dist/esm/codegen/run.d.ts.map +0 -1
- package/dist/esm/codegen/run.js.map +0 -1
- package/dist/esm/index.d.ts +0 -4
- package/dist/esm/index.d.ts.map +0 -1
- package/dist/esm/index.js +0 -4
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/models.d.ts +0 -18
- package/dist/esm/models.d.ts.map +0 -1
- package/dist/esm/models.js +0 -2
- package/dist/esm/models.js.map +0 -1
- package/dist/esm/move-coder.d.ts +0 -26
- package/dist/esm/move-coder.d.ts.map +0 -1
- package/dist/esm/move-coder.js +0 -266
- package/dist/esm/move-coder.js.map +0 -1
- package/dist/esm/sui-chain-adapter.d.ts +0 -15
- package/dist/esm/sui-chain-adapter.d.ts.map +0 -1
- package/dist/esm/sui-chain-adapter.js +0 -84
- package/dist/esm/sui-chain-adapter.js.map +0 -1
- package/dist/esm/to-internal.d.ts +0 -4
- package/dist/esm/to-internal.d.ts.map +0 -1
- package/dist/esm/to-internal.js +0 -96
- package/dist/esm/to-internal.js.map +0 -1
- package/dist/esm/transaction.d.ts +0 -15
- package/dist/esm/transaction.d.ts.map +0 -1
- package/dist/esm/transaction.js +0 -83
- package/dist/esm/transaction.js.map +0 -1
- package/src/abis/0x1.json +0 -4213
- package/src/abis/0x2.json +0 -30623
- package/src/abis/0x3.json +0 -10691
- package/src/builtin/0x1.ts +0 -6065
- package/src/builtin/0x2.ts +0 -28181
- package/src/builtin/0x3.ts +0 -9666
- package/src/builtin/index.ts +0 -6
- package/src/codegen/codegen.ts +0 -288
- package/src/codegen/index.ts +0 -1
- package/src/codegen/run.ts +0 -57
- package/src/index.ts +0 -4
- package/src/models.ts +0 -21
- package/src/move-coder.ts +0 -316
- package/src/sui-chain-adapter.ts +0 -113
- package/src/tests/abis/testnet/0x1e2b124f746a339b3cf99b9f969393a96594519aafb1d06517aacfeeae20e7a5.json +0 -265
- package/src/tests/abis/testnet/0x6c4a21e3e7e6b6d51c4604021633e1d97e24e37a696f8c082cd48f37503e602a.json +0 -2429
- package/src/tests/abis/testnet/0x7f7a37c826c88bcfe9aecc042453395ddfa9df6f29cb7c97590bf86cf2b0a75e.json +0 -1356
- package/src/tests/abis/testnet/0xebaa2ad3eacc230f309cd933958cc52684df0a41ae7ac214d186b80f830867d2.json +0 -10060
- package/src/tests/types/testnet/0x1e2b124f746a339b3cf99b9f969393a96594519aafb1d06517aacfeeae20e7a5.ts +0 -288
- package/src/tests/types/testnet/0x6c4a21e3e7e6b6d51c4604021633e1d97e24e37a696f8c082cd48f37503e602a.ts +0 -2468
- package/src/tests/types/testnet/0x7f7a37c826c88bcfe9aecc042453395ddfa9df6f29cb7c97590bf86cf2b0a75e.ts +0 -1371
- package/src/tests/types/testnet/0xebaa2ad3eacc230f309cd933958cc52684df0a41ae7ac214d186b80f830867d2.ts +0 -9495
- package/src/tests/types/testnet/index.ts +0 -7
- package/src/to-internal.ts +0 -127
- package/src/transaction.ts +0 -127
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/* Autogenerated file. Do not edit manually. */
|
|
2
|
-
/* tslint:disable */
|
|
3
|
-
/* eslint-disable */
|
|
4
|
-
export * as _0x1e2b124f746a339b3cf99b9f969393a96594519aafb1d06517aacfeeae20e7a5 from './0x1e2b124f746a339b3cf99b9f969393a96594519aafb1d06517aacfeeae20e7a5.js'
|
|
5
|
-
export * as _0x6c4a21e3e7e6b6d51c4604021633e1d97e24e37a696f8c082cd48f37503e602a from './0x6c4a21e3e7e6b6d51c4604021633e1d97e24e37a696f8c082cd48f37503e602a.js'
|
|
6
|
-
export * as _0x7f7a37c826c88bcfe9aecc042453395ddfa9df6f29cb7c97590bf86cf2b0a75e from './0x7f7a37c826c88bcfe9aecc042453395ddfa9df6f29cb7c97590bf86cf2b0a75e.js'
|
|
7
|
-
export * as _0xebaa2ad3eacc230f309cd933958cc52684df0a41ae7ac214d186b80f830867d2 from './0xebaa2ad3eacc230f309cd933958cc52684df0a41ae7ac214d186b80f830867d2.js'
|
package/src/to-internal.ts
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
IotaMoveNormalizedEnum,
|
|
3
|
-
IotaMoveNormalizedField,
|
|
4
|
-
IotaMoveNormalizedFunction,
|
|
5
|
-
IotaMoveNormalizedModule,
|
|
6
|
-
IotaMoveNormalizedStruct,
|
|
7
|
-
IotaMoveNormalizedType
|
|
8
|
-
} from '@iota/iota-sdk/client'
|
|
9
|
-
import {
|
|
10
|
-
InternalMoveEnum,
|
|
11
|
-
InternalMoveFunction,
|
|
12
|
-
InternalMoveFunctionVisibility,
|
|
13
|
-
InternalMoveModule,
|
|
14
|
-
InternalMoveStruct,
|
|
15
|
-
InternalMoveStructField,
|
|
16
|
-
SPLITTER,
|
|
17
|
-
TypeDescriptor
|
|
18
|
-
} from '@typemove/move'
|
|
19
|
-
|
|
20
|
-
export function toInternalModule(module: IotaMoveNormalizedModule): InternalMoveModule {
|
|
21
|
-
return {
|
|
22
|
-
address: module.address,
|
|
23
|
-
exposedFunctions: Object.entries(module.exposedFunctions).map(([n, f]) => toInternalFunction(n, f)),
|
|
24
|
-
name: module.name,
|
|
25
|
-
structs: Object.entries(module.structs).map(([n, s]) => toInternalStruct(n, s)),
|
|
26
|
-
enums: Object.entries(module.enums || {}).map(([n, e]) => toInternalEnum(n, e))
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function toInternalFunction(name: string, func: IotaMoveNormalizedFunction): InternalMoveFunction {
|
|
31
|
-
let visibility
|
|
32
|
-
switch (func.visibility) {
|
|
33
|
-
case 'Private':
|
|
34
|
-
visibility = InternalMoveFunctionVisibility.PRIVATE
|
|
35
|
-
break
|
|
36
|
-
case 'Public':
|
|
37
|
-
visibility = InternalMoveFunctionVisibility.PUBLIC
|
|
38
|
-
break
|
|
39
|
-
case 'Friend':
|
|
40
|
-
visibility = InternalMoveFunctionVisibility.FRIEND
|
|
41
|
-
break
|
|
42
|
-
default:
|
|
43
|
-
throw Error('No visibility for function' + name)
|
|
44
|
-
}
|
|
45
|
-
return {
|
|
46
|
-
typeParams: func.typeParameters.map((p: any) => {
|
|
47
|
-
return { constraints: p.abilities }
|
|
48
|
-
}),
|
|
49
|
-
isEntry: func.isEntry,
|
|
50
|
-
name: name,
|
|
51
|
-
params: func.parameters.map(toTypeDescriptor),
|
|
52
|
-
return: func.return.map(toTypeDescriptor),
|
|
53
|
-
visibility: visibility
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function toInternalStruct(name: string, struct: IotaMoveNormalizedStruct): InternalMoveStruct {
|
|
58
|
-
return {
|
|
59
|
-
abilities: struct.abilities.abilities,
|
|
60
|
-
fields: struct.fields.map(toInternalField),
|
|
61
|
-
typeParams: struct.typeParameters.map((p: any) => {
|
|
62
|
-
return { constraints: p.constraints.abilities }
|
|
63
|
-
}),
|
|
64
|
-
isNative: false,
|
|
65
|
-
isEvent: false,
|
|
66
|
-
name: name
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function toInternalEnum(name: string, enumType: IotaMoveNormalizedEnum): InternalMoveEnum {
|
|
71
|
-
return {
|
|
72
|
-
name: name,
|
|
73
|
-
abilities: enumType.abilities.abilities,
|
|
74
|
-
typeParams: enumType.typeParameters.map((p: any) => {
|
|
75
|
-
return { constraints: p.constraints.abilities }
|
|
76
|
-
}),
|
|
77
|
-
variants: Object.entries(enumType.variants).reduce((acc: { [key: string]: InternalMoveStructField[] }, [k, v]) => {
|
|
78
|
-
acc[k] = v.map(toInternalField)
|
|
79
|
-
return acc
|
|
80
|
-
}, {})
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function toInternalField(module: IotaMoveNormalizedField): InternalMoveStructField {
|
|
85
|
-
return {
|
|
86
|
-
name: module.name,
|
|
87
|
-
type: toTypeDescriptor(module.type)
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function toTypeDescriptor(normalizedType: IotaMoveNormalizedType): TypeDescriptor {
|
|
92
|
-
if (typeof normalizedType === 'string') {
|
|
93
|
-
return new TypeDescriptor(normalizedType)
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
if ('Struct' in normalizedType) {
|
|
97
|
-
const qname = [normalizedType.Struct.address, normalizedType.Struct.module, normalizedType.Struct.name].join(
|
|
98
|
-
SPLITTER
|
|
99
|
-
)
|
|
100
|
-
|
|
101
|
-
const args = normalizedType.Struct.typeArguments.map(toTypeDescriptor)
|
|
102
|
-
|
|
103
|
-
return new TypeDescriptor(qname, args)
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
if ('Vector' in normalizedType) {
|
|
107
|
-
return new TypeDescriptor('Vector', [toTypeDescriptor(normalizedType.Vector)])
|
|
108
|
-
}
|
|
109
|
-
if ('TypeParameter' in normalizedType) {
|
|
110
|
-
return new TypeDescriptor('T' + normalizedType.TypeParameter)
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
if ('Reference' in normalizedType) {
|
|
114
|
-
const res = toTypeDescriptor(normalizedType.Reference)
|
|
115
|
-
res.reference = true
|
|
116
|
-
return res
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
if ('MutableReference' in normalizedType) {
|
|
120
|
-
const res = toTypeDescriptor(normalizedType.MutableReference)
|
|
121
|
-
res.reference = true
|
|
122
|
-
res.mutable = true
|
|
123
|
-
return res
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
throw new Error('Unexpected sui type')
|
|
127
|
-
}
|
package/src/transaction.ts
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { Transaction, TransactionArgument, TransactionObjectInput } from '@iota/iota-sdk/transactions'
|
|
2
|
-
|
|
3
|
-
export function isTransactionArgument(value: any): boolean {
|
|
4
|
-
if (typeof value !== 'object') return false
|
|
5
|
-
if (value === null || value === undefined) return false
|
|
6
|
-
|
|
7
|
-
return (
|
|
8
|
-
value.$kind === 'GasCoin' || value.$kind === 'Result' || value.$kind === 'NestedResult' || value.$kind === 'Input'
|
|
9
|
-
)
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function transactionArgumentOrObject(
|
|
13
|
-
value: TransactionObjectInput,
|
|
14
|
-
transactionBlock: Transaction
|
|
15
|
-
): TransactionArgument {
|
|
16
|
-
// if (isTransactionArgument(value)) {
|
|
17
|
-
// return value as TransactionArgument
|
|
18
|
-
// }
|
|
19
|
-
return transactionBlock.object(value)
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function transactionArgumentOrPure(value: any, transactionBlock: Transaction): any {
|
|
23
|
-
if (isTransactionArgument(value)) {
|
|
24
|
-
return value
|
|
25
|
-
}
|
|
26
|
-
return typeof value == 'string' ? transactionBlock.pure.string(value) : transactionBlock.pure.u64(value)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function transactionArgumentOrPureString(
|
|
30
|
-
value: TransactionArgument | string,
|
|
31
|
-
transactionBlock: Transaction
|
|
32
|
-
): TransactionArgument {
|
|
33
|
-
if (isTransactionArgument(value)) {
|
|
34
|
-
return value as TransactionArgument
|
|
35
|
-
}
|
|
36
|
-
return transactionBlock.pure.string(value as string)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export function transactionArgumentOrPureAddress(
|
|
40
|
-
value: TransactionArgument | string,
|
|
41
|
-
transactionBlock: Transaction
|
|
42
|
-
): TransactionArgument {
|
|
43
|
-
if (isTransactionArgument(value)) {
|
|
44
|
-
return value as TransactionArgument
|
|
45
|
-
}
|
|
46
|
-
return transactionBlock.pure.address(value as string)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export function transactionArgumentOrPureU8(
|
|
50
|
-
value: TransactionArgument | number,
|
|
51
|
-
transactionBlock: Transaction
|
|
52
|
-
): TransactionArgument {
|
|
53
|
-
if (isTransactionArgument(value)) {
|
|
54
|
-
return value as TransactionArgument
|
|
55
|
-
}
|
|
56
|
-
return transactionBlock.pure.u8(value as number)
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export function transactionArgumentOrPureU16(
|
|
60
|
-
value: TransactionArgument | number,
|
|
61
|
-
transactionBlock: Transaction
|
|
62
|
-
): TransactionArgument {
|
|
63
|
-
if (isTransactionArgument(value)) {
|
|
64
|
-
return value as TransactionArgument
|
|
65
|
-
}
|
|
66
|
-
return transactionBlock.pure.u16(value as number)
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export function transactionArgumentOrPureU32(
|
|
70
|
-
value: TransactionArgument | number,
|
|
71
|
-
transactionBlock: Transaction
|
|
72
|
-
): TransactionArgument {
|
|
73
|
-
if (isTransactionArgument(value)) {
|
|
74
|
-
return value as TransactionArgument
|
|
75
|
-
}
|
|
76
|
-
return transactionBlock.pure.u32(value as number)
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export function transactionArgumentOrPureU64(
|
|
80
|
-
value: TransactionArgument | bigint | number | string,
|
|
81
|
-
transactionBlock: Transaction
|
|
82
|
-
): TransactionArgument {
|
|
83
|
-
if (isTransactionArgument(value)) {
|
|
84
|
-
return value as TransactionArgument
|
|
85
|
-
}
|
|
86
|
-
return transactionBlock.pure.u64(value as number)
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export function transactionArgumentOrPureU128(
|
|
90
|
-
value: TransactionArgument | bigint | number | string,
|
|
91
|
-
transactionBlock: Transaction
|
|
92
|
-
): TransactionArgument {
|
|
93
|
-
if (isTransactionArgument(value)) {
|
|
94
|
-
return value as TransactionArgument
|
|
95
|
-
}
|
|
96
|
-
return transactionBlock.pure.u128(value as number)
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export function transactionArgumentOrPureU256(
|
|
100
|
-
value: TransactionArgument | bigint | number | string,
|
|
101
|
-
transactionBlock: Transaction
|
|
102
|
-
): TransactionArgument {
|
|
103
|
-
if (isTransactionArgument(value)) {
|
|
104
|
-
return value as TransactionArgument
|
|
105
|
-
}
|
|
106
|
-
return transactionBlock.pure.u256(value as number)
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export function transactionArgumentOrPureBool(
|
|
110
|
-
value: TransactionArgument | boolean,
|
|
111
|
-
transactionBlock: Transaction
|
|
112
|
-
): TransactionArgument {
|
|
113
|
-
if (isTransactionArgument(value)) {
|
|
114
|
-
return value as TransactionArgument
|
|
115
|
-
}
|
|
116
|
-
return transactionBlock.pure.bool(value as boolean)
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// TODO vector might be nested
|
|
120
|
-
export function transactionArgumentOrVec(value: any, transactionBlock: Transaction): any {
|
|
121
|
-
if (isTransactionArgument(value)) {
|
|
122
|
-
return value
|
|
123
|
-
}
|
|
124
|
-
return transactionBlock.makeMoveVec({
|
|
125
|
-
elements: value.map((a: any) => transactionBlock.object(a))
|
|
126
|
-
})
|
|
127
|
-
}
|