@0xobelisk/sui-client 0.5.19 → 0.5.21
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 +277 -126
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +277 -126
- package/dist/index.mjs.map +1 -1
- package/dist/obelisk.d.ts +4 -4
- package/dist/types/index.d.ts +18 -21
- package/package.json +1 -1
- package/src/obelisk.ts +332 -139
- package/src/types/index.ts +20 -28
package/dist/index.mjs
CHANGED
|
@@ -941,7 +941,7 @@ function createTx(meta, fn) {
|
|
|
941
941
|
}
|
|
942
942
|
);
|
|
943
943
|
}
|
|
944
|
-
var _query, _tx,
|
|
944
|
+
var _query, _tx, _object, _exec, _read, _bcs;
|
|
945
945
|
var Obelisk = class {
|
|
946
946
|
/**
|
|
947
947
|
* Support the following ways to init the ObeliskClient:
|
|
@@ -965,7 +965,49 @@ var Obelisk = class {
|
|
|
965
965
|
} = {}) {
|
|
966
966
|
__privateAdd(this, _query, {});
|
|
967
967
|
__privateAdd(this, _tx, {});
|
|
968
|
-
__privateAdd(this,
|
|
968
|
+
__privateAdd(this, _object, {
|
|
969
|
+
address: bcs2.bytes(32).transform({
|
|
970
|
+
// To change the input type, you need to provide a type definition for the input
|
|
971
|
+
input: (val) => fromHEX2(val),
|
|
972
|
+
output: (val) => toHEX(val)
|
|
973
|
+
}),
|
|
974
|
+
u8: bcs2.u8(),
|
|
975
|
+
u16: bcs2.u16(),
|
|
976
|
+
u32: bcs2.u32(),
|
|
977
|
+
u64: bcs2.u64(),
|
|
978
|
+
u128: bcs2.u128(),
|
|
979
|
+
u256: bcs2.u256(),
|
|
980
|
+
bool: bcs2.bool(),
|
|
981
|
+
"0x1::ascii::String": bcs2.string(),
|
|
982
|
+
"0x1::option::Option<address>": bcs2.option(
|
|
983
|
+
bcs2.bytes(32).transform({
|
|
984
|
+
// To change the input type, you need to provide a type definition for the input
|
|
985
|
+
input: (val) => fromHEX2(val),
|
|
986
|
+
output: (val) => toHEX(val)
|
|
987
|
+
})
|
|
988
|
+
),
|
|
989
|
+
"0x1::option::Option<u8>": bcs2.option(bcs2.u8()),
|
|
990
|
+
"0x1::option::Option<u16>": bcs2.option(bcs2.u16()),
|
|
991
|
+
"0x1::option::Option<u32>": bcs2.option(bcs2.u32()),
|
|
992
|
+
"0x1::option::Option<u64>": bcs2.option(bcs2.u64()),
|
|
993
|
+
"0x1::option::Option<u128>": bcs2.option(bcs2.u128()),
|
|
994
|
+
"0x1::option::Option<u256>": bcs2.option(bcs2.u256()),
|
|
995
|
+
"0x1::option::Option<bool>": bcs2.option(bcs2.bool()),
|
|
996
|
+
"vector<address>": bcs2.vector(
|
|
997
|
+
bcs2.bytes(32).transform({
|
|
998
|
+
// To change the input type, you need to provide a type definition for the input
|
|
999
|
+
input: (val) => fromHEX2(val),
|
|
1000
|
+
output: (val) => toHEX(val)
|
|
1001
|
+
})
|
|
1002
|
+
),
|
|
1003
|
+
"vector<u8>": bcs2.vector(bcs2.u8()),
|
|
1004
|
+
"vector<u16>": bcs2.vector(bcs2.u16()),
|
|
1005
|
+
"vector<u32>": bcs2.vector(bcs2.u32()),
|
|
1006
|
+
"vector<u64>": bcs2.vector(bcs2.u64()),
|
|
1007
|
+
"vector<u128>": bcs2.vector(bcs2.u128()),
|
|
1008
|
+
"vector<u256>": bcs2.vector(bcs2.u256()),
|
|
1009
|
+
"vector<bool>": bcs2.vector(bcs2.bool())
|
|
1010
|
+
});
|
|
969
1011
|
__privateAdd(this, _exec, async (meta, tx, params, typeArguments, isRaw) => {
|
|
970
1012
|
if (isRaw === true) {
|
|
971
1013
|
return tx.moveCall({
|
|
@@ -996,43 +1038,224 @@ var Obelisk = class {
|
|
|
996
1038
|
});
|
|
997
1039
|
return await this.inspectTxn(tx);
|
|
998
1040
|
});
|
|
1041
|
+
__privateAdd(this, _bcs, (bcsmeta) => {
|
|
1042
|
+
let loopFlag = false;
|
|
1043
|
+
const bcsJson = {};
|
|
1044
|
+
Object.entries(bcsmeta.objectType.fields).forEach(([index, type]) => {
|
|
1045
|
+
const objName = type.name;
|
|
1046
|
+
const objType = type.type;
|
|
1047
|
+
switch (typeof objType) {
|
|
1048
|
+
case "object":
|
|
1049
|
+
for (const [key, value] of Object.entries(objType)) {
|
|
1050
|
+
switch (key) {
|
|
1051
|
+
case "Struct":
|
|
1052
|
+
const structType = value;
|
|
1053
|
+
if (structType.address === "0x1" && structType.module === "ascii" && structType.name === "String") {
|
|
1054
|
+
bcsJson[objName] = bcs2.string();
|
|
1055
|
+
return;
|
|
1056
|
+
} else if (structType.address === "0x2" && structType.module === "object" && structType.name === "UID") {
|
|
1057
|
+
bcsJson[objName] = bcs2.fixedArray(32, bcs2.u8()).transform({
|
|
1058
|
+
input: (id) => fromHEX2(id),
|
|
1059
|
+
output: (id) => toHEX(Uint8Array.from(id))
|
|
1060
|
+
});
|
|
1061
|
+
return;
|
|
1062
|
+
} else if (structType.address === "0x2" && structType.module === "object" && structType.name === "ID") {
|
|
1063
|
+
bcsJson[objName] = bcs2.fixedArray(32, bcs2.u8()).transform({
|
|
1064
|
+
input: (id) => fromHEX2(id),
|
|
1065
|
+
output: (id) => toHEX(Uint8Array.from(id))
|
|
1066
|
+
});
|
|
1067
|
+
return;
|
|
1068
|
+
} else if (structType.address === "0x2" && structType.module === "bag" && structType.name === "Bag") {
|
|
1069
|
+
bcsJson[objName] = bcs2.fixedArray(32, bcs2.u8()).transform({
|
|
1070
|
+
input: (id) => fromHEX2(id),
|
|
1071
|
+
output: (id) => toHEX(Uint8Array.from(id))
|
|
1072
|
+
});
|
|
1073
|
+
return;
|
|
1074
|
+
} else if (structType.address === "0x1" && structType.module === "option" && structType.name === "Option") {
|
|
1075
|
+
switch (structType.typeArguments[0]) {
|
|
1076
|
+
case "U8":
|
|
1077
|
+
bcsJson[objName] = bcs2.option(bcs2.u8());
|
|
1078
|
+
return;
|
|
1079
|
+
case "U16":
|
|
1080
|
+
bcsJson[objName] = bcs2.option(bcs2.u16());
|
|
1081
|
+
return;
|
|
1082
|
+
case "U32":
|
|
1083
|
+
bcsJson[objName] = bcs2.option(bcs2.u32());
|
|
1084
|
+
return;
|
|
1085
|
+
case "U64":
|
|
1086
|
+
bcsJson[objName] = bcs2.option(bcs2.u64());
|
|
1087
|
+
return;
|
|
1088
|
+
case "U128":
|
|
1089
|
+
bcsJson[objName] = bcs2.option(bcs2.u128());
|
|
1090
|
+
return;
|
|
1091
|
+
case "U256":
|
|
1092
|
+
bcsJson[objName] = bcs2.option(bcs2.u256());
|
|
1093
|
+
return;
|
|
1094
|
+
case "Bool":
|
|
1095
|
+
bcsJson[objName] = bcs2.option(bcs2.bool());
|
|
1096
|
+
return;
|
|
1097
|
+
case "Address":
|
|
1098
|
+
bcsJson[objName] = bcs2.option(
|
|
1099
|
+
bcs2.bytes(32).transform({
|
|
1100
|
+
// To change the input type, you need to provide a type definition for the input
|
|
1101
|
+
input: (val) => fromHEX2(val),
|
|
1102
|
+
output: (val) => toHEX(val)
|
|
1103
|
+
})
|
|
1104
|
+
);
|
|
1105
|
+
return;
|
|
1106
|
+
default:
|
|
1107
|
+
}
|
|
1108
|
+
} else {
|
|
1109
|
+
if (this.object[`${structType.address}::${structType.module}::${structType.name}`] === void 0) {
|
|
1110
|
+
loopFlag = true;
|
|
1111
|
+
} else {
|
|
1112
|
+
bcsJson[objName] = this.object[`${structType.address}::${structType.module}::${structType.name}`];
|
|
1113
|
+
return;
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
return;
|
|
1117
|
+
case "Vector":
|
|
1118
|
+
switch (value) {
|
|
1119
|
+
case "U8":
|
|
1120
|
+
bcsJson[objName] = bcs2.vector(bcs2.u8());
|
|
1121
|
+
return;
|
|
1122
|
+
case "U16":
|
|
1123
|
+
bcsJson[objName] = bcs2.vector(bcs2.u16());
|
|
1124
|
+
return;
|
|
1125
|
+
case "U32":
|
|
1126
|
+
bcsJson[objName] = bcs2.vector(bcs2.u32());
|
|
1127
|
+
return;
|
|
1128
|
+
case "U64":
|
|
1129
|
+
bcsJson[objName] = bcs2.vector(bcs2.u64());
|
|
1130
|
+
return;
|
|
1131
|
+
case "U128":
|
|
1132
|
+
bcsJson[objName] = bcs2.vector(bcs2.u128());
|
|
1133
|
+
return;
|
|
1134
|
+
case "U256":
|
|
1135
|
+
bcsJson[objName] = bcs2.vector(bcs2.u256());
|
|
1136
|
+
return;
|
|
1137
|
+
case "Bool":
|
|
1138
|
+
bcsJson[objName] = bcs2.vector(bcs2.bool());
|
|
1139
|
+
return;
|
|
1140
|
+
case "Address":
|
|
1141
|
+
bcsJson[objName] = bcs2.vector(
|
|
1142
|
+
bcs2.bytes(32).transform({
|
|
1143
|
+
// To change the input type, you need to provide a type definition for the input
|
|
1144
|
+
input: (val) => fromHEX2(val),
|
|
1145
|
+
output: (val) => toHEX(val)
|
|
1146
|
+
})
|
|
1147
|
+
);
|
|
1148
|
+
return;
|
|
1149
|
+
default:
|
|
1150
|
+
}
|
|
1151
|
+
case "TypeParameter":
|
|
1152
|
+
bcsJson[objName] = bcs2.u128();
|
|
1153
|
+
return;
|
|
1154
|
+
default:
|
|
1155
|
+
throw new Error("Unsupported type");
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
return;
|
|
1159
|
+
case "string":
|
|
1160
|
+
switch (objType) {
|
|
1161
|
+
case "U8":
|
|
1162
|
+
bcsJson[objName] = bcs2.u8();
|
|
1163
|
+
return;
|
|
1164
|
+
case "U16":
|
|
1165
|
+
bcsJson[objName] = bcs2.u16();
|
|
1166
|
+
return;
|
|
1167
|
+
case "U32":
|
|
1168
|
+
bcsJson[objName] = bcs2.u32();
|
|
1169
|
+
return;
|
|
1170
|
+
case "U64":
|
|
1171
|
+
bcsJson[objName] = bcs2.u64();
|
|
1172
|
+
return;
|
|
1173
|
+
case "U128":
|
|
1174
|
+
bcsJson[objName] = bcs2.u128();
|
|
1175
|
+
return;
|
|
1176
|
+
case "U256":
|
|
1177
|
+
bcsJson[objName] = bcs2.u256();
|
|
1178
|
+
return;
|
|
1179
|
+
case "Bool":
|
|
1180
|
+
bcsJson[objName] = bcs2.bool();
|
|
1181
|
+
return;
|
|
1182
|
+
case "Address":
|
|
1183
|
+
bcsJson[objName] = bcs2.bytes(32).transform({
|
|
1184
|
+
// To change the input type, you need to provide a type definition for the input
|
|
1185
|
+
input: (val) => fromHEX2(val),
|
|
1186
|
+
output: (val) => toHEX(val)
|
|
1187
|
+
});
|
|
1188
|
+
return;
|
|
1189
|
+
default:
|
|
1190
|
+
return;
|
|
1191
|
+
}
|
|
1192
|
+
default:
|
|
1193
|
+
throw new Error("Unsupported type");
|
|
1194
|
+
}
|
|
1195
|
+
});
|
|
1196
|
+
return {
|
|
1197
|
+
bcs: bcs2.struct(bcsmeta.objectName, bcsJson),
|
|
1198
|
+
loopFlag
|
|
1199
|
+
};
|
|
1200
|
+
});
|
|
999
1201
|
this.accountManager = new SuiAccountManager({ mnemonics, secretKey });
|
|
1000
1202
|
fullnodeUrls = fullnodeUrls || [getFullnodeUrl(networkType ?? "mainnet")];
|
|
1001
1203
|
this.suiInteractor = new SuiInteractor(fullnodeUrls, networkType);
|
|
1002
1204
|
this.packageId = packageId;
|
|
1003
1205
|
if (metadata !== void 0) {
|
|
1004
1206
|
this.metadata = metadata;
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
}
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
__privateGet(this, _tx)[moduleName] = {};
|
|
1207
|
+
const maxLoopNum = 5;
|
|
1208
|
+
let loopNum = 0;
|
|
1209
|
+
let stillNeedFormat = true;
|
|
1210
|
+
while (stillNeedFormat === true && loopNum <= maxLoopNum) {
|
|
1211
|
+
let loopFlag = false;
|
|
1212
|
+
Object.values(metadata).forEach(
|
|
1213
|
+
(moudlevalue) => {
|
|
1214
|
+
const data = moudlevalue;
|
|
1215
|
+
const moduleName = data.name;
|
|
1216
|
+
const objMoudleId = `${packageId}::${moduleName}`;
|
|
1217
|
+
Object.entries(data.structs).forEach(([objectName, objectType]) => {
|
|
1218
|
+
const objId = `${objMoudleId}::${objectName}`;
|
|
1219
|
+
const bcsmeta = {
|
|
1220
|
+
objectName,
|
|
1221
|
+
objectType
|
|
1222
|
+
};
|
|
1223
|
+
let bcsObj = __privateGet(this, _bcs).call(this, bcsmeta);
|
|
1224
|
+
if (bcsObj.loopFlag === true) {
|
|
1225
|
+
loopFlag = bcsObj.loopFlag;
|
|
1025
1226
|
}
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1227
|
+
__privateGet(this, _object)[objId] = bcsObj.bcs;
|
|
1228
|
+
});
|
|
1229
|
+
Object.entries(data.exposedFunctions).forEach(
|
|
1230
|
+
([funcName, funcvalue]) => {
|
|
1231
|
+
const meta = funcvalue;
|
|
1232
|
+
meta.moduleName = moduleName;
|
|
1233
|
+
meta.funcName = funcName;
|
|
1234
|
+
if (isUndefined(__privateGet(this, _query)[moduleName])) {
|
|
1235
|
+
__privateGet(this, _query)[moduleName] = {};
|
|
1236
|
+
}
|
|
1237
|
+
if (isUndefined(__privateGet(this, _query)[moduleName][funcName])) {
|
|
1238
|
+
__privateGet(this, _query)[moduleName][funcName] = createQuery(
|
|
1239
|
+
meta,
|
|
1240
|
+
(tx, p, typeArguments, isRaw) => __privateGet(this, _read).call(this, meta, tx, p, typeArguments, isRaw)
|
|
1241
|
+
);
|
|
1242
|
+
}
|
|
1243
|
+
if (isUndefined(__privateGet(this, _tx)[moduleName])) {
|
|
1244
|
+
__privateGet(this, _tx)[moduleName] = {};
|
|
1245
|
+
}
|
|
1246
|
+
if (isUndefined(__privateGet(this, _tx)[moduleName][funcName])) {
|
|
1247
|
+
__privateGet(this, _tx)[moduleName][funcName] = createTx(
|
|
1248
|
+
meta,
|
|
1249
|
+
(tx, p, typeArguments, isRaw) => __privateGet(this, _exec).call(this, meta, tx, p, typeArguments, isRaw)
|
|
1250
|
+
);
|
|
1251
|
+
}
|
|
1031
1252
|
}
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1253
|
+
);
|
|
1254
|
+
}
|
|
1255
|
+
);
|
|
1256
|
+
stillNeedFormat = loopFlag;
|
|
1257
|
+
loopNum++;
|
|
1258
|
+
}
|
|
1036
1259
|
}
|
|
1037
1260
|
this.contractFactory = new SuiContractFactory({
|
|
1038
1261
|
packageId,
|
|
@@ -1045,8 +1268,23 @@ var Obelisk = class {
|
|
|
1045
1268
|
get tx() {
|
|
1046
1269
|
return __privateGet(this, _tx);
|
|
1047
1270
|
}
|
|
1048
|
-
get
|
|
1049
|
-
return __privateGet(this,
|
|
1271
|
+
get object() {
|
|
1272
|
+
return __privateGet(this, _object);
|
|
1273
|
+
}
|
|
1274
|
+
view(dryResult) {
|
|
1275
|
+
let returnValues = [];
|
|
1276
|
+
if (dryResult.effects.status.status === "success") {
|
|
1277
|
+
const resultList = dryResult.results[0].returnValues;
|
|
1278
|
+
for (const res of resultList) {
|
|
1279
|
+
let baseValue = res[0];
|
|
1280
|
+
let baseType = res[1];
|
|
1281
|
+
const value = Uint8Array.from(baseValue);
|
|
1282
|
+
returnValues.push(this.object[baseType].parse(value));
|
|
1283
|
+
}
|
|
1284
|
+
return returnValues;
|
|
1285
|
+
} else {
|
|
1286
|
+
return void 0;
|
|
1287
|
+
}
|
|
1050
1288
|
}
|
|
1051
1289
|
/**
|
|
1052
1290
|
* if derivePathParams is not provided or mnemonics is empty, it will return the keypair.
|
|
@@ -1264,50 +1502,11 @@ var Obelisk = class {
|
|
|
1264
1502
|
if (entityId !== void 0) {
|
|
1265
1503
|
params.push(tx.pure.address(entityId));
|
|
1266
1504
|
}
|
|
1267
|
-
const
|
|
1505
|
+
const dryResult = await this.query[schemaModuleName].get(
|
|
1268
1506
|
tx,
|
|
1269
1507
|
params
|
|
1270
1508
|
);
|
|
1271
|
-
|
|
1272
|
-
if (getResult.effects.status.status === "success") {
|
|
1273
|
-
const resultList = getResult.results[0].returnValues;
|
|
1274
|
-
for (const res of resultList) {
|
|
1275
|
-
let baseValue = res[0];
|
|
1276
|
-
let baseType = res[1];
|
|
1277
|
-
const value = Uint8Array.from(baseValue);
|
|
1278
|
-
if (baseType === "address") {
|
|
1279
|
-
const Address = bcs2.bytes(32).transform({
|
|
1280
|
-
// To change the input type, you need to provide a type definition for the input
|
|
1281
|
-
input: (val) => fromHEX2(val),
|
|
1282
|
-
output: (val) => toHEX(val)
|
|
1283
|
-
});
|
|
1284
|
-
returnValues.push(Address.parse(value));
|
|
1285
|
-
} else if (baseType === "u8") {
|
|
1286
|
-
returnValues.push(bcs2.u8().parse(value));
|
|
1287
|
-
} else if (baseType === "u16") {
|
|
1288
|
-
returnValues.push(bcs2.u16().parse(value));
|
|
1289
|
-
} else if (baseType === "u32") {
|
|
1290
|
-
returnValues.push(bcs2.u32().parse(value));
|
|
1291
|
-
} else if (baseType === "u64") {
|
|
1292
|
-
returnValues.push(bcs2.u64().parse(value));
|
|
1293
|
-
} else if (baseType === "u128") {
|
|
1294
|
-
returnValues.push(bcs2.u128().parse(value));
|
|
1295
|
-
} else if (baseType === "u256") {
|
|
1296
|
-
returnValues.push(bcs2.u256().parse(value));
|
|
1297
|
-
} else if (baseType === "bool") {
|
|
1298
|
-
returnValues.push(bcs2.bool().parse(value));
|
|
1299
|
-
} else if (baseType === "0x1::ascii::String") {
|
|
1300
|
-
returnValues.push(bcs2.string().parse(value));
|
|
1301
|
-
} else if (baseType === "vector<u8>") {
|
|
1302
|
-
returnValues.push(bcs2.vector(bcs2.u8()).parse(value));
|
|
1303
|
-
} else if (baseType === "0x1::option::Option<u8>") {
|
|
1304
|
-
returnValues.push(bcs2.option(bcs2.u8()).parse(value));
|
|
1305
|
-
}
|
|
1306
|
-
}
|
|
1307
|
-
return returnValues;
|
|
1308
|
-
} else {
|
|
1309
|
-
return void 0;
|
|
1310
|
-
}
|
|
1509
|
+
return this.view(dryResult);
|
|
1311
1510
|
}
|
|
1312
1511
|
async containEntity(worldId, schemaName, entityId) {
|
|
1313
1512
|
const schemaModuleName = `${schemaName}_schema`;
|
|
@@ -1316,18 +1515,11 @@ var Obelisk = class {
|
|
|
1316
1515
|
if (entityId !== void 0) {
|
|
1317
1516
|
params.push(tx.pure.address(entityId));
|
|
1318
1517
|
}
|
|
1319
|
-
const
|
|
1518
|
+
const dryResult = await this.query[schemaModuleName].contains(
|
|
1320
1519
|
tx,
|
|
1321
1520
|
params
|
|
1322
1521
|
);
|
|
1323
|
-
|
|
1324
|
-
const res = getResult.results[0].returnValues[0];
|
|
1325
|
-
let baseValue = res[0];
|
|
1326
|
-
const value = Uint8Array.from(baseValue);
|
|
1327
|
-
return bcs2.bool().parse(value);
|
|
1328
|
-
} else {
|
|
1329
|
-
return void 0;
|
|
1330
|
-
}
|
|
1522
|
+
return this.view(dryResult);
|
|
1331
1523
|
}
|
|
1332
1524
|
// async getEntities(
|
|
1333
1525
|
// worldId: string,
|
|
@@ -1424,54 +1616,13 @@ var Obelisk = class {
|
|
|
1424
1616
|
// const u8Value = Uint8Array.from(value);
|
|
1425
1617
|
// return bcs.de(type, u8Value);
|
|
1426
1618
|
// }
|
|
1427
|
-
async autoFormatDryValue(value) {
|
|
1428
|
-
let returnValues = [];
|
|
1429
|
-
if (value.effects.status.status === "success") {
|
|
1430
|
-
const resultList = value.results[0].returnValues;
|
|
1431
|
-
for (const res of resultList) {
|
|
1432
|
-
let baseValue = res[0];
|
|
1433
|
-
let baseType = res[1];
|
|
1434
|
-
const value2 = Uint8Array.from(baseValue);
|
|
1435
|
-
if (baseType === "address") {
|
|
1436
|
-
const Address = bcs2.bytes(32).transform({
|
|
1437
|
-
// To change the input type, you need to provide a type definition for the input
|
|
1438
|
-
input: (val) => fromHEX2(val),
|
|
1439
|
-
output: (val) => toHEX(val)
|
|
1440
|
-
});
|
|
1441
|
-
returnValues.push(Address.parse(value2));
|
|
1442
|
-
} else if (baseType === "u8") {
|
|
1443
|
-
returnValues.push(bcs2.u8().parse(value2));
|
|
1444
|
-
} else if (baseType === "u16") {
|
|
1445
|
-
returnValues.push(bcs2.u16().parse(value2));
|
|
1446
|
-
} else if (baseType === "u32") {
|
|
1447
|
-
returnValues.push(bcs2.u32().parse(value2));
|
|
1448
|
-
} else if (baseType === "u64") {
|
|
1449
|
-
returnValues.push(bcs2.u64().parse(value2));
|
|
1450
|
-
} else if (baseType === "u128") {
|
|
1451
|
-
returnValues.push(bcs2.u128().parse(value2));
|
|
1452
|
-
} else if (baseType === "u256") {
|
|
1453
|
-
returnValues.push(bcs2.u256().parse(value2));
|
|
1454
|
-
} else if (baseType === "bool") {
|
|
1455
|
-
returnValues.push(bcs2.bool().parse(value2));
|
|
1456
|
-
} else if (baseType === "0x1::ascii::String") {
|
|
1457
|
-
returnValues.push(bcs2.string().parse(value2));
|
|
1458
|
-
} else if (baseType === "vector<u8>") {
|
|
1459
|
-
returnValues.push(bcs2.vector(bcs2.u8()).parse(value2));
|
|
1460
|
-
} else if (baseType === "0x1::option::Option<u8>") {
|
|
1461
|
-
returnValues.push(bcs2.option(bcs2.u8()).parse(value2));
|
|
1462
|
-
}
|
|
1463
|
-
}
|
|
1464
|
-
return returnValues;
|
|
1465
|
-
} else {
|
|
1466
|
-
return void 0;
|
|
1467
|
-
}
|
|
1468
|
-
}
|
|
1469
1619
|
};
|
|
1470
1620
|
_query = new WeakMap();
|
|
1471
1621
|
_tx = new WeakMap();
|
|
1472
|
-
|
|
1622
|
+
_object = new WeakMap();
|
|
1473
1623
|
_exec = new WeakMap();
|
|
1474
1624
|
_read = new WeakMap();
|
|
1625
|
+
_bcs = new WeakMap();
|
|
1475
1626
|
|
|
1476
1627
|
// src/libs/multiSig/client.ts
|
|
1477
1628
|
import { MultiSigPublicKey } from "@mysten/sui/multisig";
|