@typemove/sui 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/Readme.md +19 -17
- package/package.json +3 -3
- package/dist/esm/builtin/0x1.d.ts +0 -1030
- package/dist/esm/builtin/0x1.d.ts.map +0 -1
- package/dist/esm/builtin/0x1.js +0 -7799
- package/dist/esm/builtin/0x1.js.map +0 -1
- package/dist/esm/builtin/0x2.d.ts +0 -4766
- package/dist/esm/builtin/0x2.d.ts.map +0 -1
- package/dist/esm/builtin/0x2.js +0 -23180
- package/dist/esm/builtin/0x2.js.map +0 -1
- package/dist/esm/builtin/0x3.d.ts +0 -1964
- package/dist/esm/builtin/0x3.d.ts.map +0 -1
- package/dist/esm/builtin/0x3.js +0 -7606
- 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 -247
- 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 -5
- package/dist/esm/index.d.ts.map +0 -1
- package/dist/esm/index.js +0 -5
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/models.d.ts +0 -21
- 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 -28
- package/dist/esm/move-coder.d.ts.map +0 -1
- package/dist/esm/move-coder.js +0 -311
- package/dist/esm/move-coder.js.map +0 -1
- package/dist/esm/move-coder.test.d.ts +0 -2
- package/dist/esm/move-coder.test.d.ts.map +0 -1
- package/dist/esm/move-coder.test.js.map +0 -1
- package/dist/esm/sui-chain-adapter.d.ts +0 -28
- package/dist/esm/sui-chain-adapter.d.ts.map +0 -1
- package/dist/esm/sui-chain-adapter.js +0 -109
- package/dist/esm/sui-chain-adapter.js.map +0 -1
- package/dist/esm/to-internal.d.ts +0 -6
- package/dist/esm/to-internal.d.ts.map +0 -1
- package/dist/esm/to-internal.js +0 -170
- 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 -9096
- package/src/abis/0x2.json +0 -38512
- package/src/abis/0x3.json +0 -14755
- package/src/builtin/0x1.ts +0 -10657
- package/src/builtin/0x2.ts +0 -33567
- package/src/builtin/0x3.ts +0 -11437
- package/src/builtin/index.ts +0 -6
- package/src/codegen/codegen.ts +0 -292
- package/src/codegen/index.ts +0 -1
- package/src/codegen/run.ts +0 -57
- package/src/index.ts +0 -13
- package/src/models.ts +0 -32
- package/src/move-coder.ts +0 -364
- package/src/sui-chain-adapter.ts +0 -142
- package/src/tests/abis/testnet/0x1e2b124f746a339b3cf99b9f969393a96594519aafb1d06517aacfeeae20e7a5.json +0 -341
- package/src/tests/abis/testnet/0x6c4a21e3e7e6b6d51c4604021633e1d97e24e37a696f8c082cd48f37503e602a.json +0 -3375
- package/src/tests/abis/testnet/0x7f7a37c826c88bcfe9aecc042453395ddfa9df6f29cb7c97590bf86cf2b0a75e.json +0 -1535
- package/src/tests/abis/testnet/0xdee9.json +0 -10176
- package/src/tests/abis/testnet/0xebaa2ad3eacc230f309cd933958cc52684df0a41ae7ac214d186b80f830867d2.json +0 -12904
- package/src/tests/abis/testnet/enum.json +0 -6859
- package/src/tests/types/testnet/0x1e2b124f746a339b3cf99b9f969393a96594519aafb1d06517aacfeeae20e7a5.ts +0 -314
- package/src/tests/types/testnet/0x6c4a21e3e7e6b6d51c4604021633e1d97e24e37a696f8c082cd48f37503e602a.ts +0 -2819
- package/src/tests/types/testnet/0x7f7a37c826c88bcfe9aecc042453395ddfa9df6f29cb7c97590bf86cf2b0a75e.ts +0 -1594
- package/src/tests/types/testnet/0xdee9.ts +0 -7049
- package/src/tests/types/testnet/0xebaa2ad3eacc230f309cd933958cc52684df0a41ae7ac214d186b80f830867d2.ts +0 -10609
- package/src/tests/types/testnet/enum.ts +0 -6297
- package/src/tests/types/testnet/index.ts +0 -9
- package/src/to-internal.ts +0 -201
- package/src/transaction.ts +0 -127
|
@@ -1,9 +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 _0xdee9 from './0xdee9.js'
|
|
8
|
-
export * as _0xebaa2ad3eacc230f309cd933958cc52684df0a41ae7ac214d186b80f830867d2 from './0xebaa2ad3eacc230f309cd933958cc52684df0a41ae7ac214d186b80f830867d2.js'
|
|
9
|
-
export * as _enum from './enum.js'
|
package/src/to-internal.ts
DELETED
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
import type { GrpcTypes } from '@mysten/sui/grpc'
|
|
2
|
-
import {
|
|
3
|
-
accountTypeString,
|
|
4
|
-
InternalMoveEnum,
|
|
5
|
-
InternalMoveFunction,
|
|
6
|
-
InternalMoveFunctionVisibility,
|
|
7
|
-
InternalMoveModule,
|
|
8
|
-
InternalMoveStruct,
|
|
9
|
-
InternalMoveStructField,
|
|
10
|
-
SPLITTER,
|
|
11
|
-
TypeDescriptor
|
|
12
|
-
} from '@typemove/move'
|
|
13
|
-
|
|
14
|
-
// Re-exports for convenience: callers used to import named types from
|
|
15
|
-
// '@mysten/sui/jsonRpc'; now they come from the gRPC proto namespace.
|
|
16
|
-
type Module = GrpcTypes.Module
|
|
17
|
-
type DatatypeDescriptor = GrpcTypes.DatatypeDescriptor
|
|
18
|
-
type FieldDescriptor = GrpcTypes.FieldDescriptor
|
|
19
|
-
type FunctionDescriptor = GrpcTypes.FunctionDescriptor
|
|
20
|
-
type OpenSignature = GrpcTypes.OpenSignature
|
|
21
|
-
type OpenSignatureBody = GrpcTypes.OpenSignatureBody
|
|
22
|
-
|
|
23
|
-
// Proto enum constants kept as literals so we can compare against
|
|
24
|
-
// the ordinals returned in the wire-decoded shape without importing
|
|
25
|
-
// the namespaced enum at runtime.
|
|
26
|
-
const DATATYPE_KIND_STRUCT = 1
|
|
27
|
-
const DATATYPE_KIND_ENUM = 2
|
|
28
|
-
|
|
29
|
-
const VISIBILITY_PRIVATE = 1
|
|
30
|
-
const VISIBILITY_PUBLIC = 2
|
|
31
|
-
const VISIBILITY_FRIEND = 3
|
|
32
|
-
|
|
33
|
-
// OpenSignatureBody.Type
|
|
34
|
-
const TYPE_ADDRESS = 1
|
|
35
|
-
const TYPE_BOOL = 2
|
|
36
|
-
const TYPE_U8 = 3
|
|
37
|
-
const TYPE_U16 = 4
|
|
38
|
-
const TYPE_U32 = 5
|
|
39
|
-
const TYPE_U64 = 6
|
|
40
|
-
const TYPE_U128 = 7
|
|
41
|
-
const TYPE_U256 = 8
|
|
42
|
-
const TYPE_VECTOR = 9
|
|
43
|
-
const TYPE_DATATYPE = 10
|
|
44
|
-
const TYPE_TYPE_PARAMETER = 11
|
|
45
|
-
|
|
46
|
-
const ABILITY_NAMES: Record<number, string> = {
|
|
47
|
-
1: 'Copy',
|
|
48
|
-
2: 'Drop',
|
|
49
|
-
3: 'Store',
|
|
50
|
-
4: 'Key'
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// Convert a proto Module (from movePackageService.getPackage().package.modules[i])
|
|
54
|
-
// into typemove's InternalMoveModule. `packageAddress` is needed because the
|
|
55
|
-
// proto Module doesn't repeat the package id on every module entry.
|
|
56
|
-
export function toInternalModule(module: Module, packageAddress: string): InternalMoveModule {
|
|
57
|
-
packageAddress = accountTypeString(packageAddress)
|
|
58
|
-
const datatypes = module.datatypes ?? []
|
|
59
|
-
const functions = module.functions ?? []
|
|
60
|
-
|
|
61
|
-
const structs: InternalMoveStruct[] = datatypes.filter((d) => d.kind === DATATYPE_KIND_STRUCT).map(toInternalStruct)
|
|
62
|
-
|
|
63
|
-
const enums: InternalMoveEnum[] = datatypes.filter((d) => d.kind === DATATYPE_KIND_ENUM).map(toInternalEnum)
|
|
64
|
-
|
|
65
|
-
return {
|
|
66
|
-
address: packageAddress,
|
|
67
|
-
name: module.name ?? '',
|
|
68
|
-
exposedFunctions: functions.map(toInternalFunction),
|
|
69
|
-
structs,
|
|
70
|
-
enums
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function toInternalFunction(func: FunctionDescriptor): InternalMoveFunction {
|
|
75
|
-
let visibility: InternalMoveFunctionVisibility
|
|
76
|
-
switch (func.visibility) {
|
|
77
|
-
case VISIBILITY_PRIVATE:
|
|
78
|
-
visibility = InternalMoveFunctionVisibility.PRIVATE
|
|
79
|
-
break
|
|
80
|
-
case VISIBILITY_PUBLIC:
|
|
81
|
-
visibility = InternalMoveFunctionVisibility.PUBLIC
|
|
82
|
-
break
|
|
83
|
-
case VISIBILITY_FRIEND:
|
|
84
|
-
visibility = InternalMoveFunctionVisibility.FRIEND
|
|
85
|
-
break
|
|
86
|
-
default:
|
|
87
|
-
throw Error(`No visibility for function ${func.name}`)
|
|
88
|
-
}
|
|
89
|
-
return {
|
|
90
|
-
typeParams: (func.typeParameters ?? []).map((p) => ({
|
|
91
|
-
constraints: (p.constraints ?? []).map(abilityName)
|
|
92
|
-
})),
|
|
93
|
-
isEntry: func.isEntry ?? false,
|
|
94
|
-
name: func.name ?? '',
|
|
95
|
-
params: (func.parameters ?? []).map(toTypeDescriptorFromSignature),
|
|
96
|
-
return: (func.returns ?? []).map(toTypeDescriptorFromSignature),
|
|
97
|
-
visibility
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
function toInternalStruct(d: DatatypeDescriptor): InternalMoveStruct {
|
|
102
|
-
return {
|
|
103
|
-
abilities: (d.abilities ?? []).map(abilityName),
|
|
104
|
-
fields: (d.fields ?? []).map(toInternalField),
|
|
105
|
-
typeParams: (d.typeParameters ?? []).map((p) => ({
|
|
106
|
-
constraints: (p.constraints ?? []).map(abilityName)
|
|
107
|
-
})),
|
|
108
|
-
isNative: false,
|
|
109
|
-
isEvent: false,
|
|
110
|
-
name: d.name ?? ''
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
function toInternalEnum(d: DatatypeDescriptor): InternalMoveEnum {
|
|
115
|
-
const variants: { [key: string]: InternalMoveStructField[] } = {}
|
|
116
|
-
for (const v of d.variants ?? []) {
|
|
117
|
-
variants[v.name ?? ''] = (v.fields ?? []).map(toInternalField)
|
|
118
|
-
}
|
|
119
|
-
return {
|
|
120
|
-
name: d.name ?? '',
|
|
121
|
-
abilities: (d.abilities ?? []).map(abilityName),
|
|
122
|
-
typeParams: (d.typeParameters ?? []).map((p) => ({
|
|
123
|
-
constraints: (p.constraints ?? []).map(abilityName)
|
|
124
|
-
})),
|
|
125
|
-
variants
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
function toInternalField(f: FieldDescriptor): InternalMoveStructField {
|
|
130
|
-
if (!f.type) {
|
|
131
|
-
throw Error(`Field ${f.name} has no type`)
|
|
132
|
-
}
|
|
133
|
-
return {
|
|
134
|
-
name: f.name ?? '',
|
|
135
|
-
type: toTypeDescriptorFromBody(f.type)
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
// OpenSignature wraps an OpenSignatureBody with an optional reference marker.
|
|
140
|
-
// Used for function params and returns.
|
|
141
|
-
function toTypeDescriptorFromSignature(sig: OpenSignature): TypeDescriptor {
|
|
142
|
-
if (!sig.body) {
|
|
143
|
-
throw Error('OpenSignature has no body')
|
|
144
|
-
}
|
|
145
|
-
const desc = toTypeDescriptorFromBody(sig.body)
|
|
146
|
-
// Reference.IMMUTABLE=1, MUTABLE=2
|
|
147
|
-
if (sig.reference === 1) {
|
|
148
|
-
desc.reference = true
|
|
149
|
-
} else if (sig.reference === 2) {
|
|
150
|
-
desc.reference = true
|
|
151
|
-
desc.mutable = true
|
|
152
|
-
}
|
|
153
|
-
return desc
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
function toTypeDescriptorFromBody(body: OpenSignatureBody): TypeDescriptor {
|
|
157
|
-
switch (body.type) {
|
|
158
|
-
case TYPE_ADDRESS:
|
|
159
|
-
return new TypeDescriptor('Address')
|
|
160
|
-
case TYPE_BOOL:
|
|
161
|
-
return new TypeDescriptor('Bool')
|
|
162
|
-
case TYPE_U8:
|
|
163
|
-
return new TypeDescriptor('U8')
|
|
164
|
-
case TYPE_U16:
|
|
165
|
-
return new TypeDescriptor('U16')
|
|
166
|
-
case TYPE_U32:
|
|
167
|
-
return new TypeDescriptor('U32')
|
|
168
|
-
case TYPE_U64:
|
|
169
|
-
return new TypeDescriptor('U64')
|
|
170
|
-
case TYPE_U128:
|
|
171
|
-
return new TypeDescriptor('U128')
|
|
172
|
-
case TYPE_U256:
|
|
173
|
-
return new TypeDescriptor('U256')
|
|
174
|
-
case TYPE_VECTOR: {
|
|
175
|
-
const inner = body.typeParameterInstantiation?.[0]
|
|
176
|
-
if (!inner) throw Error('Vector OpenSignatureBody missing type parameter')
|
|
177
|
-
return new TypeDescriptor('Vector', [toTypeDescriptorFromBody(inner)])
|
|
178
|
-
}
|
|
179
|
-
case TYPE_DATATYPE: {
|
|
180
|
-
// gRPC emits typeName as `<defining_id>::<module>::<name>` with the
|
|
181
|
-
// address in canonical long form (0x0000...0002). Normalize to the
|
|
182
|
-
// short form (0x2) so module-lookup keys match what's loaded into
|
|
183
|
-
// MoveCoder by short-form aware code paths.
|
|
184
|
-
const raw = body.typeName ?? ''
|
|
185
|
-
const parts = raw.split(SPLITTER)
|
|
186
|
-
const qname = parts.length === 3 ? [accountTypeString(parts[0]), parts[1], parts[2]].join(SPLITTER) : raw
|
|
187
|
-
const args = (body.typeParameterInstantiation ?? []).map(toTypeDescriptorFromBody)
|
|
188
|
-
return new TypeDescriptor(qname, args)
|
|
189
|
-
}
|
|
190
|
-
case TYPE_TYPE_PARAMETER:
|
|
191
|
-
return new TypeDescriptor('T' + (body.typeParameter ?? 0))
|
|
192
|
-
default:
|
|
193
|
-
throw new Error(`Unexpected OpenSignatureBody type: ${body.type}`)
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
function abilityName(a: number): string {
|
|
198
|
-
const n = ABILITY_NAMES[a]
|
|
199
|
-
if (!n) throw Error(`Unknown Ability value: ${a}`)
|
|
200
|
-
return n
|
|
201
|
-
}
|
package/src/transaction.ts
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { Transaction, TransactionArgument, TransactionObjectInput } from '@mysten/sui/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
|
-
}
|