@mysten/sui 2.21.0 → 2.22.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/CHANGELOG.md +16 -0
- package/dist/client/address-balance-transaction-expiration.mjs +22 -0
- package/dist/client/address-balance-transaction-expiration.mjs.map +1 -0
- package/dist/cryptography/signature.d.mts +6 -6
- package/dist/graphql/core.d.mts.map +1 -1
- package/dist/graphql/core.mjs +11 -1
- package/dist/graphql/core.mjs.map +1 -1
- package/dist/graphql/generated/queries.mjs +3 -0
- package/dist/graphql/generated/queries.mjs.map +1 -1
- package/dist/grpc/client.d.mts +46 -6
- package/dist/grpc/client.d.mts.map +1 -1
- package/dist/grpc/client.mjs.map +1 -1
- package/dist/grpc/core.d.mts.map +1 -1
- package/dist/grpc/core.mjs +46 -53
- package/dist/grpc/core.mjs.map +1 -1
- package/dist/grpc/index.d.mts +2 -2
- package/dist/grpc/proto/sui/forking/v1alpha/forking_service.client.d.mts +4 -4
- package/dist/grpc/proto/sui/rpc/v2/effects.d.mts +1 -1
- package/dist/grpc/proto/sui/rpc/v2/ledger_service.client.d.mts +4 -4
- package/dist/grpc/proto/sui/rpc/v2/move_package_service.client.d.mts +4 -4
- package/dist/grpc/proto/sui/rpc/v2/name_service.client.d.mts +4 -4
- package/dist/grpc/proto/sui/rpc/v2/object.d.mts +1 -1
- package/dist/grpc/proto/sui/rpc/v2/signature_verification_service.client.d.mts +4 -4
- package/dist/grpc/proto/sui/rpc/v2/state_service.client.d.mts +4 -4
- package/dist/grpc/proto/sui/rpc/v2/subscription_service.client.d.mts +4 -4
- package/dist/grpc/proto/sui/rpc/v2/transaction.d.mts +1 -1
- package/dist/grpc/proto/sui/rpc/v2/transaction_execution_service.client.d.mts +4 -4
- package/dist/grpc/proto/sui/rpc/v2/transaction_execution_service.d.mts +1 -1
- package/dist/grpc/proto/types.d.mts +2 -2
- package/dist/version.mjs +1 -1
- package/dist/version.mjs.map +1 -1
- package/dist/zklogin/address.mjs +2 -2
- package/dist/zklogin/address.mjs.map +1 -1
- package/dist/zklogin/poseidon.mjs +5 -2
- package/dist/zklogin/poseidon.mjs.map +1 -1
- package/package.json +1 -1
- package/src/client/address-balance-transaction-expiration.ts +53 -0
- package/src/graphql/core.ts +13 -3
- package/src/graphql/generated/queries.ts +4 -1
- package/src/graphql/queries/transactions.graphql +3 -0
- package/src/grpc/client.ts +92 -20
- package/src/grpc/core.ts +86 -94
- package/src/grpc/index.ts +14 -1
- package/src/version.ts +1 -1
- package/src/zklogin/address.ts +2 -2
- package/src/zklogin/poseidon.ts +6 -4
package/dist/zklogin/address.mjs
CHANGED
|
@@ -17,8 +17,8 @@ function computeZkLoginAddressFromSeed(addressSeed, iss, legacyAddress) {
|
|
|
17
17
|
tmp.set(addressSeedBytesBigEndian, 2 + addressParamBytes.length);
|
|
18
18
|
return normalizeSuiAddress(bytesToHex(blake2b(tmp, { dkLen: 32 })).slice(0, SUI_ADDRESS_LENGTH * 2));
|
|
19
19
|
}
|
|
20
|
-
const MAX_HEADER_LEN_B64 =
|
|
21
|
-
const MAX_PADDED_UNSIGNED_JWT_LEN =
|
|
20
|
+
const MAX_HEADER_LEN_B64 = 279;
|
|
21
|
+
const MAX_PADDED_UNSIGNED_JWT_LEN = 1920;
|
|
22
22
|
function lengthChecks(jwt) {
|
|
23
23
|
const [header, payload] = jwt.split(".");
|
|
24
24
|
if (header.length > MAX_HEADER_LEN_B64) throw new Error(`Header is too long`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"address.mjs","names":[],"sources":["../../src/zklogin/address.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { blake2b } from '@noble/hashes/blake2.js';\nimport { bytesToHex } from '@noble/hashes/utils.js';\n\nimport { SIGNATURE_SCHEME_TO_FLAG } from '../cryptography/signature-scheme.js';\nimport { normalizeSuiAddress, SUI_ADDRESS_LENGTH } from '../utils/index.js';\nimport { decodeJwt } from './jwt-utils.js';\nimport {\n\tgenAddressSeed,\n\tnormalizeZkLoginIssuer,\n\ttoBigEndianBytes,\n\ttoPaddedBigEndianBytes,\n} from './utils.js';\n\nexport function computeZkLoginAddressFromSeed(\n\taddressSeed: bigint,\n\tiss: string,\n\tlegacyAddress: boolean,\n) {\n\t// Explicitly check for people not using typescript and ignoring the major version migration guide\n\tif (legacyAddress === undefined) {\n\t\tthrow new Error('legacyAddress parameter must be specified');\n\t}\n\tconst addressSeedBytesBigEndian = legacyAddress\n\t\t? toBigEndianBytes(addressSeed, 32)\n\t\t: toPaddedBigEndianBytes(addressSeed, 32);\n\n\tconst addressParamBytes = new TextEncoder().encode(normalizeZkLoginIssuer(iss));\n\tconst tmp = new Uint8Array(2 + addressSeedBytesBigEndian.length + addressParamBytes.length);\n\n\ttmp.set([SIGNATURE_SCHEME_TO_FLAG.ZkLogin]);\n\ttmp.set([addressParamBytes.length], 1);\n\ttmp.set(addressParamBytes, 2);\n\ttmp.set(addressSeedBytesBigEndian, 2 + addressParamBytes.length);\n\n\treturn normalizeSuiAddress(\n\t\tbytesToHex(blake2b(tmp, { dkLen: 32 })).slice(0, SUI_ADDRESS_LENGTH * 2),\n\t);\n}\n\nexport const MAX_HEADER_LEN_B64 =
|
|
1
|
+
{"version":3,"file":"address.mjs","names":[],"sources":["../../src/zklogin/address.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { blake2b } from '@noble/hashes/blake2.js';\nimport { bytesToHex } from '@noble/hashes/utils.js';\n\nimport { SIGNATURE_SCHEME_TO_FLAG } from '../cryptography/signature-scheme.js';\nimport { normalizeSuiAddress, SUI_ADDRESS_LENGTH } from '../utils/index.js';\nimport { decodeJwt } from './jwt-utils.js';\nimport {\n\tgenAddressSeed,\n\tnormalizeZkLoginIssuer,\n\ttoBigEndianBytes,\n\ttoPaddedBigEndianBytes,\n} from './utils.js';\n\nexport function computeZkLoginAddressFromSeed(\n\taddressSeed: bigint,\n\tiss: string,\n\tlegacyAddress: boolean,\n) {\n\t// Explicitly check for people not using typescript and ignoring the major version migration guide\n\tif (legacyAddress === undefined) {\n\t\tthrow new Error('legacyAddress parameter must be specified');\n\t}\n\tconst addressSeedBytesBigEndian = legacyAddress\n\t\t? toBigEndianBytes(addressSeed, 32)\n\t\t: toPaddedBigEndianBytes(addressSeed, 32);\n\n\tconst addressParamBytes = new TextEncoder().encode(normalizeZkLoginIssuer(iss));\n\tconst tmp = new Uint8Array(2 + addressSeedBytesBigEndian.length + addressParamBytes.length);\n\n\ttmp.set([SIGNATURE_SCHEME_TO_FLAG.ZkLogin]);\n\ttmp.set([addressParamBytes.length], 1);\n\ttmp.set(addressParamBytes, 2);\n\ttmp.set(addressSeedBytesBigEndian, 2 + addressParamBytes.length);\n\n\treturn normalizeSuiAddress(\n\t\tbytesToHex(blake2b(tmp, { dkLen: 32 })).slice(0, SUI_ADDRESS_LENGTH * 2),\n\t);\n}\n\nexport const MAX_HEADER_LEN_B64 = 279;\nexport const MAX_PADDED_UNSIGNED_JWT_LEN = 64 * 30;\n\nexport function lengthChecks(jwt: string) {\n\tconst [header, payload] = jwt.split('.');\n\t/// Is the header small enough\n\tif (header.length > MAX_HEADER_LEN_B64) {\n\t\tthrow new Error(`Header is too long`);\n\t}\n\n\t/// Is the combined length of (header, payload, SHA2 padding) small enough?\n\t// unsigned_jwt = header + '.' + payload;\n\tconst L = (header.length + 1 + payload.length) * 8;\n\tconst K = (512 + 448 - ((L % 512) + 1)) % 512;\n\n\t// The SHA2 padding is 1 followed by K zeros, followed by the length of the message\n\tconst padded_unsigned_jwt_len = (L + 1 + K + 64) / 8;\n\n\t// The padded unsigned JWT must be less than the max_padded_unsigned_jwt_len\n\tif (padded_unsigned_jwt_len > MAX_PADDED_UNSIGNED_JWT_LEN) {\n\t\tthrow new Error(`JWT is too long`);\n\t}\n}\n\nexport function jwtToAddress(jwt: string, userSalt: string | bigint, legacyAddress: boolean) {\n\t// Explicitly check for people not using typescript and ignoring the major version migration guide\n\tif (legacyAddress === undefined) {\n\t\tthrow new Error('legacyAddress parameter must be specified');\n\t}\n\tlengthChecks(jwt);\n\n\tconst decodedJWT = decodeJwt(jwt);\n\n\treturn computeZkLoginAddress({\n\t\tuserSalt,\n\t\tclaimName: 'sub',\n\t\tclaimValue: decodedJWT.sub,\n\t\taud: decodedJWT.aud,\n\t\tiss: decodedJWT.iss,\n\t\tlegacyAddress,\n\t});\n}\n\nexport interface ComputeZkLoginAddressOptions {\n\tclaimName: string;\n\tclaimValue: string;\n\tuserSalt: string | bigint;\n\tiss: string;\n\taud: string;\n\tlegacyAddress: boolean;\n}\n\nexport function computeZkLoginAddress({\n\tclaimName,\n\tclaimValue,\n\tiss,\n\taud,\n\tuserSalt,\n\tlegacyAddress,\n}: ComputeZkLoginAddressOptions) {\n\t// Explicitly check for people not using typescript and ignoring the major version migration guide\n\tif (legacyAddress === undefined) {\n\t\tthrow new Error('legacyAddress parameter must be specified');\n\t}\n\treturn computeZkLoginAddressFromSeed(\n\t\tgenAddressSeed(userSalt, claimName, claimValue, aud),\n\t\tiss,\n\t\tlegacyAddress,\n\t);\n}\n"],"mappings":";;;;;;;;AAgBA,SAAgB,8BACf,aACA,KACA,eACC;AAED,KAAI,kBAAkB,OACrB,OAAM,IAAI,MAAM,4CAA4C;CAE7D,MAAM,4BAA4B,gBAC/B,iBAAiB,aAAa,GAAG,GACjC,uBAAuB,aAAa,GAAG;CAE1C,MAAM,oBAAoB,IAAI,aAAa,CAAC,OAAO,uBAAuB,IAAI,CAAC;CAC/E,MAAM,MAAM,IAAI,WAAW,IAAI,0BAA0B,SAAS,kBAAkB,OAAO;AAE3F,KAAI,IAAI,CAAC,yBAAyB,QAAQ,CAAC;AAC3C,KAAI,IAAI,CAAC,kBAAkB,OAAO,EAAE,EAAE;AACtC,KAAI,IAAI,mBAAmB,EAAE;AAC7B,KAAI,IAAI,2BAA2B,IAAI,kBAAkB,OAAO;AAEhE,QAAO,oBACN,WAAW,QAAQ,KAAK,EAAE,OAAO,IAAI,CAAC,CAAC,CAAC,MAAM,GAAG,qBAAqB,EAAE,CACxE;;AAGF,MAAa,qBAAqB;AAClC,MAAa,8BAA8B;AAE3C,SAAgB,aAAa,KAAa;CACzC,MAAM,CAAC,QAAQ,WAAW,IAAI,MAAM,IAAI;AAExC,KAAI,OAAO,SAAS,mBACnB,OAAM,IAAI,MAAM,qBAAqB;CAKtC,MAAM,KAAK,OAAO,SAAS,IAAI,QAAQ,UAAU;CACjD,MAAM,KAAK,OAAc,IAAI,MAAO,MAAM;AAM1C,MAHiC,IAAI,IAAI,IAAI,MAAM,IAGrB,4BAC7B,OAAM,IAAI,MAAM,kBAAkB;;AAIpC,SAAgB,aAAa,KAAa,UAA2B,eAAwB;AAE5F,KAAI,kBAAkB,OACrB,OAAM,IAAI,MAAM,4CAA4C;AAE7D,cAAa,IAAI;CAEjB,MAAM,aAAa,UAAU,IAAI;AAEjC,QAAO,sBAAsB;EAC5B;EACA,WAAW;EACX,YAAY,WAAW;EACvB,KAAK,WAAW;EAChB,KAAK,WAAW;EAChB;EACA,CAAC;;AAYH,SAAgB,sBAAsB,EACrC,WACA,YACA,KACA,KACA,UACA,iBACgC;AAEhC,KAAI,kBAAkB,OACrB,OAAM,IAAI,MAAM,4CAA4C;AAE7D,QAAO,8BACN,eAAe,UAAU,WAAW,YAAY,IAAI,EACpD,KACA,cACA"}
|
|
@@ -27,8 +27,11 @@ function poseidonHash(inputs) {
|
|
|
27
27
|
});
|
|
28
28
|
const hashFN = poseidonNumToHashFN[inputs.length - 1];
|
|
29
29
|
if (hashFN) return hashFN(inputs);
|
|
30
|
-
else if (inputs.length
|
|
31
|
-
|
|
30
|
+
else if (inputs.length > 16 && inputs.length <= 64) {
|
|
31
|
+
const chunkHashes = [];
|
|
32
|
+
for (let i = 0; i < inputs.length; i += 16) chunkHashes.push(poseidonHash(inputs.slice(i, i + 16)));
|
|
33
|
+
return poseidonHash(chunkHashes);
|
|
34
|
+
} else throw new Error(`Yet to implement: Unable to hash a vector of length ${inputs.length}`);
|
|
32
35
|
}
|
|
33
36
|
|
|
34
37
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"poseidon.mjs","names":[],"sources":["../../src/zklogin/poseidon.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n\tposeidon1,\n\tposeidon2,\n\tposeidon3,\n\tposeidon4,\n\tposeidon5,\n\tposeidon6,\n\tposeidon7,\n\tposeidon8,\n\tposeidon9,\n\tposeidon10,\n\tposeidon11,\n\tposeidon12,\n\tposeidon13,\n\tposeidon14,\n\tposeidon15,\n\tposeidon16,\n} from 'poseidon-lite';\n\nconst poseidonNumToHashFN = [\n\tposeidon1,\n\tposeidon2,\n\tposeidon3,\n\tposeidon4,\n\tposeidon5,\n\tposeidon6,\n\tposeidon7,\n\tposeidon8,\n\tposeidon9,\n\tposeidon10,\n\tposeidon11,\n\tposeidon12,\n\tposeidon13,\n\tposeidon14,\n\tposeidon15,\n\tposeidon16,\n];\n\nexport const BN254_FIELD_SIZE =\n\t21888242871839275222246405745257275088548364400416034343698204186575808495617n;\n\nexport function poseidonHash(inputs: (number | bigint | string)[]): bigint {\n\tinputs.forEach((x) => {\n\t\tconst b = BigInt(x);\n\t\tif (b < 0 || b >= BN254_FIELD_SIZE) {\n\t\t\tthrow new Error(`Element ${b} not in the BN254 field`);\n\t\t}\n\t});\n\n\tconst hashFN = poseidonNumToHashFN[inputs.length - 1];\n\n\tif (hashFN) {\n\t\treturn hashFN(inputs);\n\t} else if (inputs.length <=
|
|
1
|
+
{"version":3,"file":"poseidon.mjs","names":[],"sources":["../../src/zklogin/poseidon.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n\tposeidon1,\n\tposeidon2,\n\tposeidon3,\n\tposeidon4,\n\tposeidon5,\n\tposeidon6,\n\tposeidon7,\n\tposeidon8,\n\tposeidon9,\n\tposeidon10,\n\tposeidon11,\n\tposeidon12,\n\tposeidon13,\n\tposeidon14,\n\tposeidon15,\n\tposeidon16,\n} from 'poseidon-lite';\n\nconst poseidonNumToHashFN = [\n\tposeidon1,\n\tposeidon2,\n\tposeidon3,\n\tposeidon4,\n\tposeidon5,\n\tposeidon6,\n\tposeidon7,\n\tposeidon8,\n\tposeidon9,\n\tposeidon10,\n\tposeidon11,\n\tposeidon12,\n\tposeidon13,\n\tposeidon14,\n\tposeidon15,\n\tposeidon16,\n];\n\nexport const BN254_FIELD_SIZE =\n\t21888242871839275222246405745257275088548364400416034343698204186575808495617n;\n\nexport function poseidonHash(inputs: (number | bigint | string)[]): bigint {\n\tinputs.forEach((x) => {\n\t\tconst b = BigInt(x);\n\t\tif (b < 0 || b >= BN254_FIELD_SIZE) {\n\t\t\tthrow new Error(`Element ${b} not in the BN254 field`);\n\t\t}\n\t});\n\n\tconst hashFN = poseidonNumToHashFN[inputs.length - 1];\n\n\tif (hashFN) {\n\t\treturn hashFN(inputs);\n\t} else if (inputs.length > 16 && inputs.length <= 64) {\n\t\tconst chunkHashes = [];\n\t\tfor (let i = 0; i < inputs.length; i += 16) {\n\t\t\tchunkHashes.push(poseidonHash(inputs.slice(i, i + 16)));\n\t\t}\n\t\treturn poseidonHash(chunkHashes);\n\t} else {\n\t\tthrow new Error(`Yet to implement: Unable to hash a vector of length ${inputs.length}`);\n\t}\n}\n"],"mappings":";;;AAsBA,MAAM,sBAAsB;CAC3B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAED,MAAa,mBACZ;AAED,SAAgB,aAAa,QAA8C;AAC1E,QAAO,SAAS,MAAM;EACrB,MAAM,IAAI,OAAO,EAAE;AACnB,MAAI,IAAI,KAAK,KAAK,iBACjB,OAAM,IAAI,MAAM,WAAW,EAAE,yBAAyB;GAEtD;CAEF,MAAM,SAAS,oBAAoB,OAAO,SAAS;AAEnD,KAAI,OACH,QAAO,OAAO,OAAO;UACX,OAAO,SAAS,MAAM,OAAO,UAAU,IAAI;EACrD,MAAM,cAAc,EAAE;AACtB,OAAK,IAAI,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAK,GACvC,aAAY,KAAK,aAAa,OAAO,MAAM,GAAG,IAAI,GAAG,CAAC,CAAC;AAExD,SAAO,aAAa,YAAY;OAEhC,OAAM,IAAI,MAAM,uDAAuD,OAAO,SAAS"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// Copyright (c) Mysten Labs, Inc.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import type { TransactionDataBuilder } from '../transactions/TransactionData.js';
|
|
5
|
+
import type { TransactionData } from '../transactions/data/internal.js';
|
|
6
|
+
import type { ClientWithCoreApi } from './core.js';
|
|
7
|
+
|
|
8
|
+
export async function setAddressBalanceTransactionExpirationFromSimulatedEpoch({
|
|
9
|
+
transactionData,
|
|
10
|
+
client,
|
|
11
|
+
epoch,
|
|
12
|
+
originalTransactionData,
|
|
13
|
+
isTransactionKindOnly,
|
|
14
|
+
doGasSelection,
|
|
15
|
+
}: {
|
|
16
|
+
transactionData: TransactionDataBuilder;
|
|
17
|
+
client: ClientWithCoreApi;
|
|
18
|
+
epoch: string | number | bigint | null | undefined;
|
|
19
|
+
originalTransactionData: TransactionData;
|
|
20
|
+
isTransactionKindOnly: boolean;
|
|
21
|
+
doGasSelection: boolean;
|
|
22
|
+
}) {
|
|
23
|
+
if (
|
|
24
|
+
isTransactionKindOnly ||
|
|
25
|
+
doGasSelection ||
|
|
26
|
+
originalTransactionData.expiration ||
|
|
27
|
+
originalTransactionData.gasData.payment?.length !== 0
|
|
28
|
+
) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (transactionData.expiration && transactionData.expiration.$kind !== 'None') {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const [{ chainIdentifier }, systemStateResult] = await Promise.all([
|
|
37
|
+
client.core.getChainIdentifier(),
|
|
38
|
+
epoch == null ? client.core.getCurrentSystemState() : null,
|
|
39
|
+
]);
|
|
40
|
+
const currentEpoch = BigInt(epoch ?? systemStateResult!.systemState.epoch);
|
|
41
|
+
|
|
42
|
+
transactionData.expiration = {
|
|
43
|
+
$kind: 'ValidDuring',
|
|
44
|
+
ValidDuring: {
|
|
45
|
+
minEpoch: String(currentEpoch),
|
|
46
|
+
maxEpoch: String(currentEpoch + 1n),
|
|
47
|
+
minTimestamp: null,
|
|
48
|
+
maxTimestamp: null,
|
|
49
|
+
chain: chainIdentifier,
|
|
50
|
+
nonce: (Math.random() * 0x100000000) >>> 0,
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
}
|
package/src/graphql/core.ts
CHANGED
|
@@ -44,6 +44,7 @@ import {
|
|
|
44
44
|
transactionToGrpcJson,
|
|
45
45
|
grpcTransactionToTransactionData,
|
|
46
46
|
} from '../client/transaction-resolver.js';
|
|
47
|
+
import { setAddressBalanceTransactionExpirationFromSimulatedEpoch } from '../client/address-balance-transaction-expiration.js';
|
|
47
48
|
import { BalanceChange as BalanceChangeType } from '../grpc/proto/sui/rpc/v2/balance_change.js';
|
|
48
49
|
import { TransactionEffects as TransactionEffectsType } from '../grpc/proto/sui/rpc/v2/effects.js';
|
|
49
50
|
import { Transaction as GrpcTransactionType } from '../grpc/proto/sui/rpc/v2/transaction.js';
|
|
@@ -732,14 +733,15 @@ export class GraphQLCoreClient extends CoreClient {
|
|
|
732
733
|
}
|
|
733
734
|
const grpcTransaction = transactionDataToGrpcTransaction(snapshot);
|
|
734
735
|
const transactionJson = GrpcTransactionType.toJson(grpcTransaction);
|
|
736
|
+
const doGasSelection =
|
|
737
|
+
!options.onlyTransactionKind &&
|
|
738
|
+
(snapshot.gasData.budget == null || snapshot.gasData.payment == null);
|
|
735
739
|
|
|
736
740
|
const { data, errors } = await graphqlClient.query({
|
|
737
741
|
query: ResolveTransactionDocument,
|
|
738
742
|
variables: {
|
|
739
743
|
transaction: transactionJson,
|
|
740
|
-
doGasSelection
|
|
741
|
-
!options.onlyTransactionKind &&
|
|
742
|
-
(snapshot.gasData.budget == null || snapshot.gasData.payment == null),
|
|
744
|
+
doGasSelection,
|
|
743
745
|
checksEnabled: !options.onlyTransactionKind,
|
|
744
746
|
},
|
|
745
747
|
});
|
|
@@ -780,6 +782,14 @@ export class GraphQLCoreClient extends CoreClient {
|
|
|
780
782
|
} else {
|
|
781
783
|
transactionData.applyResolvedData(resolved);
|
|
782
784
|
}
|
|
785
|
+
await setAddressBalanceTransactionExpirationFromSimulatedEpoch({
|
|
786
|
+
transactionData,
|
|
787
|
+
client: graphqlClient,
|
|
788
|
+
epoch: transactionEffects?.epoch?.epochId,
|
|
789
|
+
originalTransactionData: snapshot,
|
|
790
|
+
isTransactionKindOnly: !!options.onlyTransactionKind,
|
|
791
|
+
doGasSelection,
|
|
792
|
+
});
|
|
783
793
|
|
|
784
794
|
return await next();
|
|
785
795
|
};
|
|
@@ -338,7 +338,7 @@ export type ResolveTransactionQueryVariables = Exact<{
|
|
|
338
338
|
}>;
|
|
339
339
|
|
|
340
340
|
|
|
341
|
-
export type ResolveTransactionQuery = { simulateTransaction: { effects: { transaction: { transactionBcs: string | null, effects: { status: ExecutionStatus | null, executionError: { message: string, abortCode: string | null, identifier: string | null, constant: string | null, sourceLineNumber: number | null, instructionOffset: number | null, module: { name: string, package: { address: string } | null } | null, function: { name: string } | null } | null } | null } | null } | null } };
|
|
341
|
+
export type ResolveTransactionQuery = { simulateTransaction: { effects: { transaction: { transactionBcs: string | null, effects: { status: ExecutionStatus | null, epoch: { epochId: number } | null, executionError: { message: string, abortCode: string | null, identifier: string | null, constant: string | null, sourceLineNumber: number | null, instructionOffset: number | null, module: { name: string, package: { address: string } | null } | null, function: { name: string } | null } | null } | null } | null } | null } };
|
|
342
342
|
|
|
343
343
|
export type VerifyZkLoginSignatureQueryVariables = Exact<{
|
|
344
344
|
bytes: string;
|
|
@@ -1153,6 +1153,9 @@ export const ResolveTransactionDocument = new TypedDocumentString(`
|
|
|
1153
1153
|
transaction {
|
|
1154
1154
|
transactionBcs
|
|
1155
1155
|
effects {
|
|
1156
|
+
epoch {
|
|
1157
|
+
epochId
|
|
1158
|
+
}
|
|
1156
1159
|
status
|
|
1157
1160
|
executionError {
|
|
1158
1161
|
message
|
package/src/grpc/client.ts
CHANGED
|
@@ -57,6 +57,78 @@ export interface ListDynamicFieldsWithValueResponse<Include extends DynamicField
|
|
|
57
57
|
dynamicFields: DynamicFieldEntryWithValue<Include>[];
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
export interface GrpcTransactionInclude extends SuiClientTypes.TransactionInclude {
|
|
61
|
+
/** Include the parsed protobuf JSON value for the gRPC transaction response. */
|
|
62
|
+
protoJson?: boolean;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface GrpcSimulateTransactionInclude extends SuiClientTypes.SimulateTransactionInclude {
|
|
66
|
+
/** Include the parsed protobuf JSON value for the gRPC simulation response. */
|
|
67
|
+
protoJson?: boolean;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export type GrpcTransactionProtoJson = ReturnType<
|
|
71
|
+
typeof import('./proto/sui/rpc/v2/executed_transaction.js').ExecutedTransaction.toJson
|
|
72
|
+
>;
|
|
73
|
+
|
|
74
|
+
export type GrpcSimulateTransactionProtoJson = ReturnType<
|
|
75
|
+
typeof import('./proto/sui/rpc/v2/transaction_execution_service.js').SimulateTransactionResponse.toJson
|
|
76
|
+
>;
|
|
77
|
+
|
|
78
|
+
type ProtoJson<Include extends { protoJson?: boolean }, Json> = Include['protoJson'] extends true
|
|
79
|
+
? Json
|
|
80
|
+
: undefined;
|
|
81
|
+
|
|
82
|
+
export type GrpcTransactionResult<Include extends GrpcTransactionInclude = {}> =
|
|
83
|
+
SuiClientTypes.TransactionResult<Include> & {
|
|
84
|
+
protoJson: ProtoJson<Include, GrpcTransactionProtoJson>;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export type GrpcSimulateTransactionResult<Include extends GrpcSimulateTransactionInclude = {}> =
|
|
88
|
+
SuiClientTypes.SimulateTransactionResult<Include> & {
|
|
89
|
+
protoJson: ProtoJson<Include, GrpcSimulateTransactionProtoJson>;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export interface GrpcGetTransactionOptions<
|
|
93
|
+
Include extends GrpcTransactionInclude = {},
|
|
94
|
+
> extends SuiClientTypes.GetTransactionOptions<Include> {
|
|
95
|
+
include?: Include & GrpcTransactionInclude;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface GrpcWaitForTransactionByDigest<
|
|
99
|
+
Include extends GrpcTransactionInclude = {},
|
|
100
|
+
> extends SuiClientTypes.WaitForTransactionByDigest<Include> {
|
|
101
|
+
include?: Include & GrpcTransactionInclude;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export interface GrpcWaitForTransactionByResult<
|
|
105
|
+
Include extends GrpcTransactionInclude = {},
|
|
106
|
+
> extends SuiClientTypes.WaitForTransactionByResult<Include> {
|
|
107
|
+
include?: Include & GrpcTransactionInclude;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export type GrpcWaitForTransactionOptions<Include extends GrpcTransactionInclude = {}> =
|
|
111
|
+
| GrpcWaitForTransactionByDigest<Include>
|
|
112
|
+
| GrpcWaitForTransactionByResult<Include>;
|
|
113
|
+
|
|
114
|
+
export interface GrpcExecuteTransactionOptions<
|
|
115
|
+
Include extends GrpcTransactionInclude = {},
|
|
116
|
+
> extends SuiClientTypes.ExecuteTransactionOptions<Include> {
|
|
117
|
+
include?: Include & GrpcTransactionInclude;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export interface GrpcSignAndExecuteTransactionOptions<
|
|
121
|
+
Include extends GrpcTransactionInclude = {},
|
|
122
|
+
> extends SuiClientTypes.SignAndExecuteTransactionOptions<Include> {
|
|
123
|
+
include?: Include & GrpcTransactionInclude;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export interface GrpcSimulateTransactionOptions<
|
|
127
|
+
Include extends GrpcSimulateTransactionInclude = {},
|
|
128
|
+
> extends SuiClientTypes.SimulateTransactionOptions<Include> {
|
|
129
|
+
include?: Include & GrpcSimulateTransactionInclude;
|
|
130
|
+
}
|
|
131
|
+
|
|
60
132
|
export class SuiGrpcClient extends BaseClient implements SuiClientTypes.TransportMethods {
|
|
61
133
|
core: GrpcCoreClient;
|
|
62
134
|
get mvr(): SuiClientTypes.MvrMethods {
|
|
@@ -135,34 +207,34 @@ export class SuiGrpcClient extends BaseClient implements SuiClientTypes.Transpor
|
|
|
135
207
|
return this.core.getCoinMetadata(input);
|
|
136
208
|
}
|
|
137
209
|
|
|
138
|
-
getTransaction<Include extends
|
|
139
|
-
input:
|
|
140
|
-
): Promise<
|
|
141
|
-
return this.core.getTransaction(input)
|
|
210
|
+
getTransaction<Include extends GrpcTransactionInclude = {}>(
|
|
211
|
+
input: GrpcGetTransactionOptions<Include>,
|
|
212
|
+
): Promise<GrpcTransactionResult<Include>> {
|
|
213
|
+
return this.core.getTransaction(input) as Promise<GrpcTransactionResult<Include>>;
|
|
142
214
|
}
|
|
143
215
|
|
|
144
|
-
executeTransaction<Include extends
|
|
145
|
-
input:
|
|
146
|
-
): Promise<
|
|
147
|
-
return this.core.executeTransaction(input)
|
|
216
|
+
executeTransaction<Include extends GrpcTransactionInclude = {}>(
|
|
217
|
+
input: GrpcExecuteTransactionOptions<Include>,
|
|
218
|
+
): Promise<GrpcTransactionResult<Include>> {
|
|
219
|
+
return this.core.executeTransaction(input) as Promise<GrpcTransactionResult<Include>>;
|
|
148
220
|
}
|
|
149
221
|
|
|
150
|
-
signAndExecuteTransaction<Include extends
|
|
151
|
-
input:
|
|
152
|
-
): Promise<
|
|
153
|
-
return this.core.signAndExecuteTransaction(input)
|
|
222
|
+
signAndExecuteTransaction<Include extends GrpcTransactionInclude = {}>(
|
|
223
|
+
input: GrpcSignAndExecuteTransactionOptions<Include>,
|
|
224
|
+
): Promise<GrpcTransactionResult<Include>> {
|
|
225
|
+
return this.core.signAndExecuteTransaction(input) as Promise<GrpcTransactionResult<Include>>;
|
|
154
226
|
}
|
|
155
227
|
|
|
156
|
-
waitForTransaction<Include extends
|
|
157
|
-
input:
|
|
158
|
-
): Promise<
|
|
159
|
-
return this.core.waitForTransaction(input)
|
|
228
|
+
waitForTransaction<Include extends GrpcTransactionInclude = {}>(
|
|
229
|
+
input: GrpcWaitForTransactionOptions<Include>,
|
|
230
|
+
): Promise<GrpcTransactionResult<Include>> {
|
|
231
|
+
return this.core.waitForTransaction(input) as Promise<GrpcTransactionResult<Include>>;
|
|
160
232
|
}
|
|
161
233
|
|
|
162
|
-
simulateTransaction<Include extends
|
|
163
|
-
input:
|
|
164
|
-
): Promise<
|
|
165
|
-
return this.core.simulateTransaction(input)
|
|
234
|
+
simulateTransaction<Include extends GrpcSimulateTransactionInclude = {}>(
|
|
235
|
+
input: GrpcSimulateTransactionOptions<Include>,
|
|
236
|
+
): Promise<GrpcSimulateTransactionResult<Include>> {
|
|
237
|
+
return this.core.simulateTransaction(input) as Promise<GrpcSimulateTransactionResult<Include>>;
|
|
166
238
|
}
|
|
167
239
|
|
|
168
240
|
getReferenceGasPrice(): Promise<SuiClientTypes.GetReferenceGasPriceResponse> {
|
package/src/grpc/core.ts
CHANGED
|
@@ -8,7 +8,6 @@ import type { SuiGrpcClient } from './client.js';
|
|
|
8
8
|
import type { Owner } from './proto/sui/rpc/v2/owner.js';
|
|
9
9
|
import { Owner_OwnerKind } from './proto/sui/rpc/v2/owner.js';
|
|
10
10
|
import { chunk, fromBase64, toBase64 } from '@mysten/utils';
|
|
11
|
-
import type { ExecutedTransaction } from './proto/sui/rpc/v2/executed_transaction.js';
|
|
12
11
|
import type { TransactionEffects } from './proto/sui/rpc/v2/effects.js';
|
|
13
12
|
import {
|
|
14
13
|
UnchangedConsensusObject_UnchangedConsensusObjectKind,
|
|
@@ -44,13 +43,18 @@ import {
|
|
|
44
43
|
transactionToGrpcTransaction,
|
|
45
44
|
grpcTransactionToTransactionData,
|
|
46
45
|
} from '../client/transaction-resolver.js';
|
|
46
|
+
import { setAddressBalanceTransactionExpirationFromSimulatedEpoch } from '../client/address-balance-transaction-expiration.js';
|
|
47
47
|
import { Value } from './proto/google/protobuf/struct.js';
|
|
48
|
-
import
|
|
49
|
-
import {
|
|
48
|
+
import { ExecutedTransaction } from './proto/sui/rpc/v2/executed_transaction.js';
|
|
49
|
+
import {
|
|
50
|
+
SimulateTransactionRequest_TransactionChecks,
|
|
51
|
+
SimulateTransactionResponse,
|
|
52
|
+
} from './proto/sui/rpc/v2/transaction_execution_service.js';
|
|
50
53
|
|
|
51
54
|
export interface GrpcCoreClientOptions extends CoreClientOptions {
|
|
52
55
|
client: SuiGrpcClient;
|
|
53
56
|
}
|
|
57
|
+
|
|
54
58
|
export class GrpcCoreClient extends CoreClient {
|
|
55
59
|
#client: SuiGrpcClient;
|
|
56
60
|
constructor({ client, ...options }: GrpcCoreClientOptions) {
|
|
@@ -331,37 +335,11 @@ export class GrpcCoreClient extends CoreClient {
|
|
|
331
335
|
async getTransaction<Include extends SuiClientTypes.TransactionInclude = {}>(
|
|
332
336
|
options: SuiClientTypes.GetTransactionOptions<Include>,
|
|
333
337
|
): Promise<SuiClientTypes.TransactionResult<Include>> {
|
|
334
|
-
const paths = ['digest', 'transaction.digest', 'signatures', 'effects.status'];
|
|
335
|
-
if (options.include?.transaction) {
|
|
336
|
-
paths.push(
|
|
337
|
-
'transaction.sender',
|
|
338
|
-
'transaction.gas_payment',
|
|
339
|
-
'transaction.expiration',
|
|
340
|
-
'transaction.kind',
|
|
341
|
-
);
|
|
342
|
-
}
|
|
343
|
-
if (options.include?.bcs) {
|
|
344
|
-
paths.push('transaction.bcs');
|
|
345
|
-
}
|
|
346
|
-
if (options.include?.balanceChanges) {
|
|
347
|
-
paths.push('balance_changes');
|
|
348
|
-
}
|
|
349
|
-
if (options.include?.effects) {
|
|
350
|
-
paths.push('effects');
|
|
351
|
-
}
|
|
352
|
-
if (options.include?.events) {
|
|
353
|
-
paths.push('events');
|
|
354
|
-
}
|
|
355
|
-
if (options.include?.objectTypes) {
|
|
356
|
-
paths.push('effects.changed_objects.object_type');
|
|
357
|
-
paths.push('effects.changed_objects.object_id');
|
|
358
|
-
}
|
|
359
|
-
|
|
360
338
|
const { response } = await this.#client.ledgerService.getTransaction(
|
|
361
339
|
{
|
|
362
340
|
digest: options.digest,
|
|
363
341
|
readMask: {
|
|
364
|
-
paths,
|
|
342
|
+
paths: transactionReadMaskPaths(options.include),
|
|
365
343
|
},
|
|
366
344
|
},
|
|
367
345
|
{ abort: options.signal },
|
|
@@ -371,37 +349,15 @@ export class GrpcCoreClient extends CoreClient {
|
|
|
371
349
|
throw new Error(`Transaction ${options.digest} not found`);
|
|
372
350
|
}
|
|
373
351
|
|
|
374
|
-
return
|
|
352
|
+
return withProtoJson(
|
|
353
|
+
parseGrpcTransactionResponse(response.transaction, { include: options.include }),
|
|
354
|
+
options.include,
|
|
355
|
+
() => ExecutedTransaction.toJson(response.transaction!),
|
|
356
|
+
);
|
|
375
357
|
}
|
|
376
358
|
async executeTransaction<Include extends SuiClientTypes.TransactionInclude = {}>(
|
|
377
359
|
options: SuiClientTypes.ExecuteTransactionOptions<Include>,
|
|
378
360
|
): Promise<SuiClientTypes.TransactionResult<Include>> {
|
|
379
|
-
const paths = ['digest', 'transaction.digest', 'signatures', 'effects.status'];
|
|
380
|
-
if (options.include?.transaction) {
|
|
381
|
-
paths.push(
|
|
382
|
-
'transaction.sender',
|
|
383
|
-
'transaction.gas_payment',
|
|
384
|
-
'transaction.expiration',
|
|
385
|
-
'transaction.kind',
|
|
386
|
-
);
|
|
387
|
-
}
|
|
388
|
-
if (options.include?.bcs) {
|
|
389
|
-
paths.push('transaction.bcs');
|
|
390
|
-
}
|
|
391
|
-
if (options.include?.balanceChanges) {
|
|
392
|
-
paths.push('balance_changes');
|
|
393
|
-
}
|
|
394
|
-
if (options.include?.effects) {
|
|
395
|
-
paths.push('effects');
|
|
396
|
-
}
|
|
397
|
-
if (options.include?.events) {
|
|
398
|
-
paths.push('events');
|
|
399
|
-
}
|
|
400
|
-
if (options.include?.objectTypes) {
|
|
401
|
-
paths.push('effects.changed_objects.object_type');
|
|
402
|
-
paths.push('effects.changed_objects.object_id');
|
|
403
|
-
}
|
|
404
|
-
|
|
405
361
|
const { response } = await this.#client.transactionExecutionService.executeTransaction(
|
|
406
362
|
{
|
|
407
363
|
transaction: {
|
|
@@ -418,48 +374,22 @@ export class GrpcCoreClient extends CoreClient {
|
|
|
418
374
|
},
|
|
419
375
|
})),
|
|
420
376
|
readMask: {
|
|
421
|
-
paths,
|
|
377
|
+
paths: transactionReadMaskPaths(options.include),
|
|
422
378
|
},
|
|
423
379
|
},
|
|
424
380
|
{ abort: options.signal },
|
|
425
381
|
);
|
|
426
382
|
|
|
427
|
-
return
|
|
383
|
+
return withProtoJson(
|
|
384
|
+
parseGrpcTransactionResponse(response.transaction!, { include: options.include }),
|
|
385
|
+
options.include,
|
|
386
|
+
() => ExecutedTransaction.toJson(response.transaction!),
|
|
387
|
+
);
|
|
428
388
|
}
|
|
429
389
|
async simulateTransaction<Include extends SuiClientTypes.SimulateTransactionInclude = {}>(
|
|
430
390
|
options: SuiClientTypes.SimulateTransactionOptions<Include>,
|
|
431
391
|
): Promise<SuiClientTypes.SimulateTransactionResult<Include>> {
|
|
432
|
-
const paths =
|
|
433
|
-
'transaction.digest',
|
|
434
|
-
'transaction.transaction.digest',
|
|
435
|
-
'transaction.signatures',
|
|
436
|
-
'transaction.effects.status',
|
|
437
|
-
];
|
|
438
|
-
if (options.include?.transaction) {
|
|
439
|
-
paths.push(
|
|
440
|
-
'transaction.transaction.sender',
|
|
441
|
-
'transaction.transaction.gas_payment',
|
|
442
|
-
'transaction.transaction.expiration',
|
|
443
|
-
'transaction.transaction.kind',
|
|
444
|
-
);
|
|
445
|
-
}
|
|
446
|
-
if (options.include?.bcs) {
|
|
447
|
-
paths.push('transaction.transaction.bcs');
|
|
448
|
-
}
|
|
449
|
-
if (options.include?.balanceChanges) {
|
|
450
|
-
paths.push('transaction.balance_changes');
|
|
451
|
-
}
|
|
452
|
-
if (options.include?.effects) {
|
|
453
|
-
paths.push('transaction.effects');
|
|
454
|
-
}
|
|
455
|
-
if (options.include?.events) {
|
|
456
|
-
paths.push('transaction.events');
|
|
457
|
-
}
|
|
458
|
-
if (options.include?.objectTypes) {
|
|
459
|
-
// Use effects.changed_objects to match JSON-RPC behavior (which uses objectChanges)
|
|
460
|
-
paths.push('transaction.effects.changed_objects.object_type');
|
|
461
|
-
paths.push('transaction.effects.changed_objects.object_id');
|
|
462
|
-
}
|
|
392
|
+
const paths = transactionReadMaskPaths(options.include, 'transaction.');
|
|
463
393
|
if (options.include?.commandResults) {
|
|
464
394
|
paths.push('command_outputs');
|
|
465
395
|
}
|
|
@@ -490,7 +420,11 @@ export class GrpcCoreClient extends CoreClient {
|
|
|
490
420
|
{ abort: options.signal },
|
|
491
421
|
);
|
|
492
422
|
|
|
493
|
-
return
|
|
423
|
+
return withProtoJson(
|
|
424
|
+
parseGrpcSimulateTransactionResponse(response, { include: options.include }),
|
|
425
|
+
options.include,
|
|
426
|
+
() => SimulateTransactionResponse.toJson(response),
|
|
427
|
+
);
|
|
494
428
|
}
|
|
495
429
|
async getReferenceGasPrice(
|
|
496
430
|
options?: SuiClientTypes.GetReferenceGasPriceOptions,
|
|
@@ -787,14 +721,15 @@ export class GrpcCoreClient extends CoreClient {
|
|
|
787
721
|
snapshot.sender = '0x0000000000000000000000000000000000000000000000000000000000000000';
|
|
788
722
|
}
|
|
789
723
|
const grpcTransaction = transactionDataToGrpcTransaction(snapshot);
|
|
724
|
+
const doGasSelection =
|
|
725
|
+
!options.onlyTransactionKind &&
|
|
726
|
+
(snapshot.gasData.budget == null || snapshot.gasData.payment == null);
|
|
790
727
|
|
|
791
728
|
let response;
|
|
792
729
|
try {
|
|
793
730
|
const result = await client.transactionExecutionService.simulateTransaction({
|
|
794
731
|
transaction: grpcTransaction,
|
|
795
|
-
doGasSelection
|
|
796
|
-
!options.onlyTransactionKind &&
|
|
797
|
-
(snapshot.gasData.budget == null || snapshot.gasData.payment == null),
|
|
732
|
+
doGasSelection,
|
|
798
733
|
// Kind-only txns are never executed directly and do not have sender, so skip validation checks.
|
|
799
734
|
checks: options.onlyTransactionKind
|
|
800
735
|
? SimulateTransactionRequest_TransactionChecks.DISABLED
|
|
@@ -806,6 +741,7 @@ export class GrpcCoreClient extends CoreClient {
|
|
|
806
741
|
'transaction.transaction.expiration',
|
|
807
742
|
'transaction.transaction.kind',
|
|
808
743
|
'transaction.effects.status',
|
|
744
|
+
'transaction.effects.epoch',
|
|
809
745
|
],
|
|
810
746
|
},
|
|
811
747
|
});
|
|
@@ -837,12 +773,68 @@ export class GrpcCoreClient extends CoreClient {
|
|
|
837
773
|
}
|
|
838
774
|
|
|
839
775
|
applyGrpcResolvedTransaction(transactionData, response.transaction.transaction, options);
|
|
776
|
+
await setAddressBalanceTransactionExpirationFromSimulatedEpoch({
|
|
777
|
+
transactionData,
|
|
778
|
+
client,
|
|
779
|
+
epoch: response.transaction.effects?.epoch,
|
|
780
|
+
originalTransactionData: snapshot,
|
|
781
|
+
isTransactionKindOnly: !!options.onlyTransactionKind,
|
|
782
|
+
doGasSelection,
|
|
783
|
+
});
|
|
840
784
|
|
|
841
785
|
return await next();
|
|
842
786
|
};
|
|
843
787
|
}
|
|
844
788
|
}
|
|
845
789
|
|
|
790
|
+
function transactionReadMaskPaths(
|
|
791
|
+
include: SuiClientTypes.TransactionInclude | undefined,
|
|
792
|
+
prefix = '',
|
|
793
|
+
) {
|
|
794
|
+
const paths = ['digest', 'transaction.digest', 'signatures', 'effects.status'];
|
|
795
|
+
if (include?.transaction) {
|
|
796
|
+
paths.push(
|
|
797
|
+
'transaction.sender',
|
|
798
|
+
'transaction.gas_payment',
|
|
799
|
+
'transaction.expiration',
|
|
800
|
+
'transaction.kind',
|
|
801
|
+
);
|
|
802
|
+
}
|
|
803
|
+
if (include?.bcs) {
|
|
804
|
+
paths.push('transaction.bcs');
|
|
805
|
+
}
|
|
806
|
+
if (include?.balanceChanges) {
|
|
807
|
+
paths.push('balance_changes');
|
|
808
|
+
}
|
|
809
|
+
if (include?.effects) {
|
|
810
|
+
paths.push('effects');
|
|
811
|
+
}
|
|
812
|
+
if (include?.events) {
|
|
813
|
+
paths.push('events');
|
|
814
|
+
}
|
|
815
|
+
if (include?.objectTypes) {
|
|
816
|
+
paths.push('effects.changed_objects.object_type');
|
|
817
|
+
paths.push('effects.changed_objects.object_id');
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
return prefix ? paths.map((path) => prefix + path) : paths;
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
function withProtoJson<Result>(
|
|
824
|
+
result: Result,
|
|
825
|
+
include: ({ protoJson?: boolean } & object) | undefined,
|
|
826
|
+
getProtoJson: () => unknown,
|
|
827
|
+
): Result {
|
|
828
|
+
if (!include?.protoJson) {
|
|
829
|
+
return result;
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
return {
|
|
833
|
+
...result,
|
|
834
|
+
protoJson: getProtoJson(),
|
|
835
|
+
};
|
|
836
|
+
}
|
|
837
|
+
|
|
846
838
|
function mapDisplayProto(
|
|
847
839
|
include: boolean | undefined,
|
|
848
840
|
display: { output?: Value; errors?: Value } | undefined,
|
package/src/grpc/index.ts
CHANGED
|
@@ -7,7 +7,20 @@ export {
|
|
|
7
7
|
parseGrpcSimulateTransactionResponse,
|
|
8
8
|
parseGrpcTransactionResponse,
|
|
9
9
|
} from './core.js';
|
|
10
|
-
export type {
|
|
10
|
+
export type {
|
|
11
|
+
GrpcExecuteTransactionOptions,
|
|
12
|
+
GrpcGetTransactionOptions,
|
|
13
|
+
GrpcSignAndExecuteTransactionOptions,
|
|
14
|
+
GrpcSimulateTransactionInclude,
|
|
15
|
+
GrpcSimulateTransactionOptions,
|
|
16
|
+
GrpcSimulateTransactionProtoJson,
|
|
17
|
+
GrpcSimulateTransactionResult,
|
|
18
|
+
GrpcTransactionInclude,
|
|
19
|
+
GrpcTransactionProtoJson,
|
|
20
|
+
GrpcTransactionResult,
|
|
21
|
+
GrpcWaitForTransactionOptions,
|
|
22
|
+
SuiGrpcClientOptions,
|
|
23
|
+
} from './client.js';
|
|
11
24
|
export type { GrpcCoreClientOptions } from './core.js';
|
|
12
25
|
|
|
13
26
|
// Re-export transports and types so users can configure custom transports
|
package/src/version.ts
CHANGED
package/src/zklogin/address.ts
CHANGED
|
@@ -40,8 +40,8 @@ export function computeZkLoginAddressFromSeed(
|
|
|
40
40
|
);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
export const MAX_HEADER_LEN_B64 =
|
|
44
|
-
export const MAX_PADDED_UNSIGNED_JWT_LEN = 64 *
|
|
43
|
+
export const MAX_HEADER_LEN_B64 = 279;
|
|
44
|
+
export const MAX_PADDED_UNSIGNED_JWT_LEN = 64 * 30;
|
|
45
45
|
|
|
46
46
|
export function lengthChecks(jwt: string) {
|
|
47
47
|
const [header, payload] = jwt.split('.');
|