@hiero-ledger/sdk 2.79.0-beta.12 → 2.79.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/dist/umd.js +220 -2
- package/dist/umd.min.js +5 -5
- package/lib/Cache.cjs +20 -0
- package/lib/Cache.d.ts +10 -0
- package/lib/Cache.js +1 -1
- package/lib/Cache.js.map +1 -1
- package/lib/EthereumTransactionData.cjs +3 -1
- package/lib/EthereumTransactionData.d.ts +1 -1
- package/lib/EthereumTransactionData.js +1 -1
- package/lib/EthereumTransactionData.js.map +1 -1
- package/lib/EthereumTransactionDataEip7702.cjs +170 -0
- package/lib/EthereumTransactionDataEip7702.d.ts +71 -0
- package/lib/EthereumTransactionDataEip7702.js +2 -0
- package/lib/EthereumTransactionDataEip7702.js.map +1 -0
- package/lib/browser.js +1 -1
- package/lib/client/addressbooks/mainnet.cjs +1 -1
- package/lib/client/addressbooks/mainnet.d.ts +1 -1
- package/lib/client/addressbooks/mainnet.js +1 -1
- package/lib/client/addressbooks/mainnet.js.map +1 -1
- package/lib/client/addressbooks/previewnet.cjs +1 -1
- package/lib/client/addressbooks/previewnet.d.ts +1 -1
- package/lib/client/addressbooks/previewnet.js +1 -1
- package/lib/client/addressbooks/previewnet.js.map +1 -1
- package/lib/client/addressbooks/testnet.cjs +1 -1
- package/lib/client/addressbooks/testnet.d.ts +1 -1
- package/lib/client/addressbooks/testnet.js +1 -1
- package/lib/client/addressbooks/testnet.js.map +1 -1
- package/lib/exports.cjs +7 -0
- package/lib/exports.d.ts +1 -0
- package/lib/exports.js +1 -1
- package/lib/exports.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/native.js +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/src/Cache.js +26 -0
- package/src/EthereumTransactionData.js +3 -1
- package/src/EthereumTransactionDataEip7702.js +193 -0
- package/src/client/addressbooks/mainnet.js +1 -1
- package/src/client/addressbooks/previewnet.js +1 -1
- package/src/client/addressbooks/testnet.js +1 -1
- package/src/exports.js +1 -0
package/dist/umd.js
CHANGED
|
@@ -34547,6 +34547,9 @@
|
|
|
34547
34547
|
/** @type {((bytes: Uint8Array) => EthereumTransactionData) | null} */
|
|
34548
34548
|
this._ethereumTransactionDataEip2930FromBytes = null;
|
|
34549
34549
|
|
|
34550
|
+
/** @type {((bytes: Uint8Array) => EthereumTransactionData) | null} */
|
|
34551
|
+
this._ethereumTransactionDataEip7702FromBytes = null;
|
|
34552
|
+
|
|
34550
34553
|
/** @type {(() => TransactionReceiptQuery) | null} */
|
|
34551
34554
|
this._transactionReceiptQueryConstructor = null;
|
|
34552
34555
|
|
|
@@ -34831,6 +34834,29 @@
|
|
|
34831
34834
|
return this._ethereumTransactionDataEip2930FromBytes;
|
|
34832
34835
|
}
|
|
34833
34836
|
|
|
34837
|
+
/**
|
|
34838
|
+
* @param {((bytes: Uint8Array) => EthereumTransactionData)} ethereumTransactionDataEip7702FromBytes
|
|
34839
|
+
*/
|
|
34840
|
+
setEthereumTransactionDataEip7702FromBytes(
|
|
34841
|
+
ethereumTransactionDataEip7702FromBytes,
|
|
34842
|
+
) {
|
|
34843
|
+
this._ethereumTransactionDataEip7702FromBytes =
|
|
34844
|
+
ethereumTransactionDataEip7702FromBytes;
|
|
34845
|
+
}
|
|
34846
|
+
|
|
34847
|
+
/**
|
|
34848
|
+
* @returns {((bytes: Uint8Array) => EthereumTransactionData)}
|
|
34849
|
+
*/
|
|
34850
|
+
get ethereumTransactionDataEip7702FromBytes() {
|
|
34851
|
+
if (this._ethereumTransactionDataEip7702FromBytes == null) {
|
|
34852
|
+
throw new Error(
|
|
34853
|
+
"Cache.ethereumTransactionDataEip7702FromBytes was used before it was set",
|
|
34854
|
+
);
|
|
34855
|
+
}
|
|
34856
|
+
|
|
34857
|
+
return this._ethereumTransactionDataEip7702FromBytes;
|
|
34858
|
+
}
|
|
34859
|
+
|
|
34834
34860
|
/**
|
|
34835
34861
|
* @param {(() => TransactionReceiptQuery)} transactionReceiptQueryConstructor
|
|
34836
34862
|
*/
|
|
@@ -75837,7 +75863,7 @@
|
|
|
75837
75863
|
/**
|
|
75838
75864
|
* Represents the base class for Ethereum transaction data.
|
|
75839
75865
|
* This class provides the foundation for different types of Ethereum transactions
|
|
75840
|
-
* including Legacy, EIP-1559, and EIP-
|
|
75866
|
+
* including Legacy, EIP-1559, EIP-2930, and EIP-7702 transactions.
|
|
75841
75867
|
*/
|
|
75842
75868
|
class EthereumTransactionData {
|
|
75843
75869
|
/**
|
|
@@ -75863,6 +75889,8 @@
|
|
|
75863
75889
|
return CACHE.ethereumTransactionDataEip2930FromBytes(bytes);
|
|
75864
75890
|
case 2:
|
|
75865
75891
|
return CACHE.ethereumTransactionDataEip1559FromBytes(bytes);
|
|
75892
|
+
case 4:
|
|
75893
|
+
return CACHE.ethereumTransactionDataEip7702FromBytes(bytes);
|
|
75866
75894
|
default:
|
|
75867
75895
|
return CACHE.ethereumTransactionDataLegacyFromBytes(bytes);
|
|
75868
75896
|
}
|
|
@@ -76288,6 +76316,195 @@
|
|
|
76288
76316
|
EthereumTransactionDataEip2930.fromBytes(bytes),
|
|
76289
76317
|
);
|
|
76290
76318
|
|
|
76319
|
+
/**
|
|
76320
|
+
* @typedef {object} EthereumTransactionDataEip7702JSON
|
|
76321
|
+
* @property {string} chainId
|
|
76322
|
+
* @property {string} nonce
|
|
76323
|
+
* @property {string} maxPriorityGas
|
|
76324
|
+
* @property {string} maxGas
|
|
76325
|
+
* @property {string} gasLimit
|
|
76326
|
+
* @property {string} to
|
|
76327
|
+
* @property {string} value
|
|
76328
|
+
* @property {string} callData
|
|
76329
|
+
* @property {Array<[string, string, string, string, string, string]>} authorizationList - Array of [chainId, contractAddress, nonce, yParity, r, s] tuples
|
|
76330
|
+
* @property {string[]} accessList
|
|
76331
|
+
* @property {string} recId
|
|
76332
|
+
* @property {string} r
|
|
76333
|
+
* @property {string} s
|
|
76334
|
+
*/
|
|
76335
|
+
|
|
76336
|
+
class EthereumTransactionDataEip7702 extends EthereumTransactionData {
|
|
76337
|
+
/**
|
|
76338
|
+
* @private
|
|
76339
|
+
* @param {object} props
|
|
76340
|
+
* @param {Uint8Array} props.chainId
|
|
76341
|
+
* @param {Uint8Array} props.nonce
|
|
76342
|
+
* @param {Uint8Array} props.maxPriorityGas
|
|
76343
|
+
* @param {Uint8Array} props.maxGas
|
|
76344
|
+
* @param {Uint8Array} props.gasLimit
|
|
76345
|
+
* @param {Uint8Array} props.to
|
|
76346
|
+
* @param {Uint8Array} props.value
|
|
76347
|
+
* @param {Uint8Array} props.callData
|
|
76348
|
+
* @param {Array<[Uint8Array, Uint8Array, Uint8Array, Uint8Array, Uint8Array, Uint8Array]>} props.authorizationList - Array of [chainId, contractAddress, nonce, yParity, r, s] tuples
|
|
76349
|
+
* @param {Uint8Array[]} props.accessList
|
|
76350
|
+
* @param {Uint8Array} props.recId
|
|
76351
|
+
* @param {Uint8Array} props.r
|
|
76352
|
+
* @param {Uint8Array} props.s
|
|
76353
|
+
*/
|
|
76354
|
+
constructor(props) {
|
|
76355
|
+
super(props);
|
|
76356
|
+
|
|
76357
|
+
this.chainId = props.chainId;
|
|
76358
|
+
this.nonce = props.nonce;
|
|
76359
|
+
this.maxPriorityGas = props.maxPriorityGas;
|
|
76360
|
+
this.maxGas = props.maxGas;
|
|
76361
|
+
this.gasLimit = props.gasLimit;
|
|
76362
|
+
this.to = props.to;
|
|
76363
|
+
this.value = props.value;
|
|
76364
|
+
this.callData = props.callData;
|
|
76365
|
+
this.authorizationList = props.authorizationList;
|
|
76366
|
+
this.accessList = props.accessList;
|
|
76367
|
+
this.recId = props.recId;
|
|
76368
|
+
this.r = props.r;
|
|
76369
|
+
this.s = props.s;
|
|
76370
|
+
}
|
|
76371
|
+
|
|
76372
|
+
/**
|
|
76373
|
+
* @param {Uint8Array} bytes
|
|
76374
|
+
* @returns {EthereumTransactionData}
|
|
76375
|
+
*/
|
|
76376
|
+
static fromBytes(bytes) {
|
|
76377
|
+
if (bytes.length === 0) {
|
|
76378
|
+
throw new Error("empty bytes");
|
|
76379
|
+
}
|
|
76380
|
+
|
|
76381
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
76382
|
+
const decoded = /** @type {string[]} */ (decode(bytes.subarray(1)));
|
|
76383
|
+
|
|
76384
|
+
if (!Array.isArray(decoded)) {
|
|
76385
|
+
throw new Error("ethereum data is not a list");
|
|
76386
|
+
}
|
|
76387
|
+
|
|
76388
|
+
if (decoded.length !== 13) {
|
|
76389
|
+
throw new Error("invalid ethereum transaction data");
|
|
76390
|
+
}
|
|
76391
|
+
|
|
76392
|
+
// Decode authorization list: array of [chainId, contractAddress, nonce, yParity, r, s] tuples
|
|
76393
|
+
// Authorization list can be empty (empty array is valid)
|
|
76394
|
+
if (!Array.isArray(decoded[9])) {
|
|
76395
|
+
throw new Error("authorization list must be an array");
|
|
76396
|
+
}
|
|
76397
|
+
// @ts-ignore
|
|
76398
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
76399
|
+
const authorizationList = /** @type {string[]} */ (decoded[9]).map(
|
|
76400
|
+
(authTuple) => {
|
|
76401
|
+
if (!Array.isArray(authTuple) || authTuple.length !== 6) {
|
|
76402
|
+
throw new Error(
|
|
76403
|
+
"invalid authorization list entry: must be [chainId, contractAddress, nonce, yParity, r, s]",
|
|
76404
|
+
);
|
|
76405
|
+
}
|
|
76406
|
+
return [
|
|
76407
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
76408
|
+
decode$8(/** @type {string} */ (authTuple[0])), // chainId
|
|
76409
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
76410
|
+
decode$8(/** @type {string} */ (authTuple[1])), // contractAddress (20 bytes)
|
|
76411
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
76412
|
+
decode$8(/** @type {string} */ (authTuple[2])), // nonce
|
|
76413
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
76414
|
+
decode$8(/** @type {string} */ (authTuple[3])), // yParity (0 or 1)
|
|
76415
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
76416
|
+
decode$8(/** @type {string} */ (authTuple[4])), // r (32 bytes)
|
|
76417
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
76418
|
+
decode$8(/** @type {string} */ (authTuple[5])), // s (32 bytes)
|
|
76419
|
+
];
|
|
76420
|
+
},
|
|
76421
|
+
);
|
|
76422
|
+
|
|
76423
|
+
return new EthereumTransactionDataEip7702({
|
|
76424
|
+
chainId: decode$8(/** @type {string} */ (decoded[0])),
|
|
76425
|
+
nonce: decode$8(/** @type {string} */ (decoded[1])),
|
|
76426
|
+
maxPriorityGas: decode$8(/** @type {string} */ (decoded[2])),
|
|
76427
|
+
maxGas: decode$8(/** @type {string} */ (decoded[3])),
|
|
76428
|
+
gasLimit: decode$8(/** @type {string} */ (decoded[4])),
|
|
76429
|
+
to: decode$8(/** @type {string} */ (decoded[5])),
|
|
76430
|
+
value: decode$8(/** @type {string} */ (decoded[6])),
|
|
76431
|
+
callData: decode$8(/** @type {string} */ (decoded[7])),
|
|
76432
|
+
// @ts-ignore
|
|
76433
|
+
accessList: /** @type {string[]} */ (decoded[8]).map((v) =>
|
|
76434
|
+
decode$8(v),
|
|
76435
|
+
),
|
|
76436
|
+
// @ts-ignore
|
|
76437
|
+
authorizationList: authorizationList,
|
|
76438
|
+
recId: decode$8(/** @type {string} */ (decoded[10])),
|
|
76439
|
+
r: decode$8(/** @type {string} */ (decoded[11])),
|
|
76440
|
+
s: decode$8(/** @type {string} */ (decoded[12])),
|
|
76441
|
+
});
|
|
76442
|
+
}
|
|
76443
|
+
|
|
76444
|
+
/**
|
|
76445
|
+
* @returns {Uint8Array}
|
|
76446
|
+
*/
|
|
76447
|
+
toBytes() {
|
|
76448
|
+
const encoded = encode([
|
|
76449
|
+
this.chainId,
|
|
76450
|
+
this.nonce,
|
|
76451
|
+
this.maxPriorityGas,
|
|
76452
|
+
this.maxGas,
|
|
76453
|
+
this.gasLimit,
|
|
76454
|
+
this.to,
|
|
76455
|
+
this.value,
|
|
76456
|
+
this.callData,
|
|
76457
|
+
this.accessList,
|
|
76458
|
+
this.authorizationList,
|
|
76459
|
+
this.recId,
|
|
76460
|
+
this.r,
|
|
76461
|
+
this.s,
|
|
76462
|
+
]);
|
|
76463
|
+
return decode$8("04" + encoded.substring(2));
|
|
76464
|
+
}
|
|
76465
|
+
|
|
76466
|
+
/**
|
|
76467
|
+
* @returns {string}
|
|
76468
|
+
*/
|
|
76469
|
+
toString() {
|
|
76470
|
+
return JSON.stringify(this.toJSON(), null, 2);
|
|
76471
|
+
}
|
|
76472
|
+
|
|
76473
|
+
/**
|
|
76474
|
+
* @returns {EthereumTransactionDataEip7702JSON}
|
|
76475
|
+
*/
|
|
76476
|
+
toJSON() {
|
|
76477
|
+
return {
|
|
76478
|
+
chainId: encode$5(this.chainId),
|
|
76479
|
+
nonce: encode$5(this.nonce),
|
|
76480
|
+
maxPriorityGas: encode$5(this.maxPriorityGas),
|
|
76481
|
+
maxGas: encode$5(this.maxGas),
|
|
76482
|
+
gasLimit: encode$5(this.gasLimit),
|
|
76483
|
+
to: encode$5(this.to),
|
|
76484
|
+
value: encode$5(this.value),
|
|
76485
|
+
callData: encode$5(this.callData),
|
|
76486
|
+
authorizationList: this.authorizationList.map(
|
|
76487
|
+
([chainId, contractAddress, nonce, yParity, r, s]) => [
|
|
76488
|
+
encode$5(chainId),
|
|
76489
|
+
encode$5(contractAddress),
|
|
76490
|
+
encode$5(nonce),
|
|
76491
|
+
encode$5(yParity),
|
|
76492
|
+
encode$5(r),
|
|
76493
|
+
encode$5(s),
|
|
76494
|
+
],
|
|
76495
|
+
),
|
|
76496
|
+
accessList: this.accessList.map((v) => encode$5(v)),
|
|
76497
|
+
recId: encode$5(this.recId),
|
|
76498
|
+
r: encode$5(this.r),
|
|
76499
|
+
s: encode$5(this.s),
|
|
76500
|
+
};
|
|
76501
|
+
}
|
|
76502
|
+
}
|
|
76503
|
+
|
|
76504
|
+
CACHE.setEthereumTransactionDataEip7702FromBytes((bytes) =>
|
|
76505
|
+
EthereumTransactionDataEip7702.fromBytes(bytes),
|
|
76506
|
+
);
|
|
76507
|
+
|
|
76291
76508
|
// SPDX-License-Identifier: Apache-2.0
|
|
76292
76509
|
|
|
76293
76510
|
|
|
@@ -98729,7 +98946,7 @@
|
|
|
98729
98946
|
|
|
98730
98947
|
const SDK_NAME = "hiero-sdk-js";
|
|
98731
98948
|
const SDK_VERSION =
|
|
98732
|
-
"2.79.0
|
|
98949
|
+
"2.79.0" ;
|
|
98733
98950
|
|
|
98734
98951
|
// SPDX-License-Identifier: Apache-2.0
|
|
98735
98952
|
|
|
@@ -99990,6 +100207,7 @@
|
|
|
99990
100207
|
exports.EthereumTransactionData = EthereumTransactionData;
|
|
99991
100208
|
exports.EthereumTransactionDataEip1559 = EthereumTransactionDataEip1559;
|
|
99992
100209
|
exports.EthereumTransactionDataEip2930 = EthereumTransactionDataEip2930;
|
|
100210
|
+
exports.EthereumTransactionDataEip7702 = EthereumTransactionDataEip7702;
|
|
99993
100211
|
exports.EthereumTransactionDataLegacy = EthereumTransactionDataLegacy;
|
|
99994
100212
|
exports.EvmAddress = EvmAddress;
|
|
99995
100213
|
exports.ExchangeRate = ExchangeRate;
|