@fuel-ts/account 0.94.4 → 0.94.5
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.global.js +41 -170
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +39 -29
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +126 -121
- package/dist/index.mjs.map +1 -1
- package/dist/providers/__generated__/operations.d.ts +169 -0
- package/dist/providers/__generated__/operations.d.ts.map +1 -1
- package/dist/providers/fuel-graphql-subscriber.d.ts.map +1 -1
- package/dist/providers/provider.d.ts +9 -1
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/transaction-response/transaction-response.d.ts +3 -1
- package/dist/providers/transaction-response/transaction-response.d.ts.map +1 -1
- package/dist/providers/utils/receipts.d.ts.map +1 -1
- package/dist/test-utils.global.js +41 -170
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +39 -29
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +115 -110
- package/dist/test-utils.mjs.map +1 -1
- package/package.json +15 -15
package/dist/index.global.js
CHANGED
@@ -28799,9 +28799,9 @@ spurious results.`);
|
|
28799
28799
|
// ../versions/dist/index.mjs
|
28800
28800
|
function getBuiltinVersions() {
|
28801
28801
|
return {
|
28802
|
-
FORC: "0.63.
|
28802
|
+
FORC: "0.63.5",
|
28803
28803
|
FUEL_CORE: "0.35.0",
|
28804
|
-
FUELS: "0.94.
|
28804
|
+
FUELS: "0.94.5"
|
28805
28805
|
};
|
28806
28806
|
}
|
28807
28807
|
function parseVersion(version) {
|
@@ -32710,150 +32710,11 @@ If you are attempting to transform a hex value, please make sure it is being pas
|
|
32710
32710
|
ReceiptType2[ReceiptType2["Burn"] = 12] = "Burn";
|
32711
32711
|
return ReceiptType2;
|
32712
32712
|
})(ReceiptType || {});
|
32713
|
-
var ReceiptMessageOutCoder = class extends Coder {
|
32714
|
-
constructor() {
|
32715
|
-
super("ReceiptMessageOut", "struct ReceiptMessageOut", 0);
|
32716
|
-
}
|
32717
|
-
static getMessageId(value) {
|
32718
|
-
const parts = [];
|
32719
|
-
parts.push(new ByteArrayCoder(32).encode(value.sender));
|
32720
|
-
parts.push(new ByteArrayCoder(32).encode(value.recipient));
|
32721
|
-
parts.push(new ByteArrayCoder(32).encode(value.nonce));
|
32722
|
-
parts.push(new BigNumberCoder("u64").encode(value.amount));
|
32723
|
-
parts.push(arrayify(value.data || "0x"));
|
32724
|
-
return sha2562(concat(parts));
|
32725
|
-
}
|
32726
|
-
encode(value) {
|
32727
|
-
const parts = [];
|
32728
|
-
parts.push(new B256Coder().encode(value.sender));
|
32729
|
-
parts.push(new B256Coder().encode(value.recipient));
|
32730
|
-
parts.push(new BigNumberCoder("u64").encode(value.amount));
|
32731
|
-
parts.push(new B256Coder().encode(value.nonce));
|
32732
|
-
parts.push(new NumberCoder("u16", { padToWordSize: true }).encode(value.data.length));
|
32733
|
-
parts.push(new B256Coder().encode(value.digest));
|
32734
|
-
parts.push(new ByteArrayCoder(value.data.length).encode(value.data));
|
32735
|
-
return concat(parts);
|
32736
|
-
}
|
32737
|
-
decode(data, offset) {
|
32738
|
-
let decoded;
|
32739
|
-
let o = offset;
|
32740
|
-
[decoded, o] = new B256Coder().decode(data, o);
|
32741
|
-
const sender = decoded;
|
32742
|
-
[decoded, o] = new B256Coder().decode(data, o);
|
32743
|
-
const recipient = decoded;
|
32744
|
-
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
32745
|
-
const amount = decoded;
|
32746
|
-
[decoded, o] = new B256Coder().decode(data, o);
|
32747
|
-
const nonce = decoded;
|
32748
|
-
[decoded, o] = new NumberCoder("u16", { padToWordSize: true }).decode(data, o);
|
32749
|
-
const len = decoded;
|
32750
|
-
[decoded, o] = new B256Coder().decode(data, o);
|
32751
|
-
const digest = decoded;
|
32752
|
-
[decoded, o] = new ByteArrayCoder(len).decode(data, o);
|
32753
|
-
const messageData = arrayify(decoded);
|
32754
|
-
const receiptMessageOut = {
|
32755
|
-
type: 10,
|
32756
|
-
messageId: "",
|
32757
|
-
sender,
|
32758
|
-
recipient,
|
32759
|
-
amount,
|
32760
|
-
nonce,
|
32761
|
-
digest,
|
32762
|
-
data: messageData
|
32763
|
-
};
|
32764
|
-
receiptMessageOut.messageId = ReceiptMessageOutCoder.getMessageId(receiptMessageOut);
|
32765
|
-
return [receiptMessageOut, o];
|
32766
|
-
}
|
32767
|
-
};
|
32768
32713
|
var getMintedAssetId = (contractId, subId) => {
|
32769
32714
|
const contractIdBytes = arrayify(contractId);
|
32770
32715
|
const subIdBytes = arrayify(subId);
|
32771
32716
|
return sha2562(concat([contractIdBytes, subIdBytes]));
|
32772
32717
|
};
|
32773
|
-
var ReceiptMintCoder = class extends Coder {
|
32774
|
-
constructor() {
|
32775
|
-
super("ReceiptMint", "struct ReceiptMint", 0);
|
32776
|
-
}
|
32777
|
-
static getAssetId(contractId, subId) {
|
32778
|
-
return getMintedAssetId(contractId, subId);
|
32779
|
-
}
|
32780
|
-
encode(value) {
|
32781
|
-
const parts = [];
|
32782
|
-
parts.push(new B256Coder().encode(value.subId));
|
32783
|
-
parts.push(new B256Coder().encode(value.contractId));
|
32784
|
-
parts.push(new BigNumberCoder("u64").encode(value.val));
|
32785
|
-
parts.push(new BigNumberCoder("u64").encode(value.pc));
|
32786
|
-
parts.push(new BigNumberCoder("u64").encode(value.is));
|
32787
|
-
return concat(parts);
|
32788
|
-
}
|
32789
|
-
decode(data, offset) {
|
32790
|
-
let decoded;
|
32791
|
-
let o = offset;
|
32792
|
-
[decoded, o] = new B256Coder().decode(data, o);
|
32793
|
-
const subId = decoded;
|
32794
|
-
[decoded, o] = new B256Coder().decode(data, o);
|
32795
|
-
const contractId = decoded;
|
32796
|
-
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
32797
|
-
const val = decoded;
|
32798
|
-
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
32799
|
-
const pc = decoded;
|
32800
|
-
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
32801
|
-
const is = decoded;
|
32802
|
-
const assetId = ReceiptMintCoder.getAssetId(contractId, subId);
|
32803
|
-
const receiptMint = {
|
32804
|
-
type: 11,
|
32805
|
-
subId,
|
32806
|
-
contractId,
|
32807
|
-
val,
|
32808
|
-
pc,
|
32809
|
-
is,
|
32810
|
-
assetId
|
32811
|
-
};
|
32812
|
-
return [receiptMint, o];
|
32813
|
-
}
|
32814
|
-
};
|
32815
|
-
var ReceiptBurnCoder = class extends Coder {
|
32816
|
-
constructor() {
|
32817
|
-
super("ReceiptBurn", "struct ReceiptBurn", 0);
|
32818
|
-
}
|
32819
|
-
static getAssetId(contractId, subId) {
|
32820
|
-
return getMintedAssetId(contractId, subId);
|
32821
|
-
}
|
32822
|
-
encode(value) {
|
32823
|
-
const parts = [];
|
32824
|
-
parts.push(new B256Coder().encode(value.subId));
|
32825
|
-
parts.push(new B256Coder().encode(value.contractId));
|
32826
|
-
parts.push(new BigNumberCoder("u64").encode(value.val));
|
32827
|
-
parts.push(new BigNumberCoder("u64").encode(value.pc));
|
32828
|
-
parts.push(new BigNumberCoder("u64").encode(value.is));
|
32829
|
-
return concat(parts);
|
32830
|
-
}
|
32831
|
-
decode(data, offset) {
|
32832
|
-
let decoded;
|
32833
|
-
let o = offset;
|
32834
|
-
[decoded, o] = new B256Coder().decode(data, o);
|
32835
|
-
const subId = decoded;
|
32836
|
-
[decoded, o] = new B256Coder().decode(data, o);
|
32837
|
-
const contractId = decoded;
|
32838
|
-
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
32839
|
-
const val = decoded;
|
32840
|
-
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
32841
|
-
const pc = decoded;
|
32842
|
-
[decoded, o] = new BigNumberCoder("u64").decode(data, o);
|
32843
|
-
const is = decoded;
|
32844
|
-
const assetId = ReceiptMintCoder.getAssetId(contractId, subId);
|
32845
|
-
const receiptBurn = {
|
32846
|
-
type: 12,
|
32847
|
-
subId,
|
32848
|
-
contractId,
|
32849
|
-
val,
|
32850
|
-
pc,
|
32851
|
-
is,
|
32852
|
-
assetId
|
32853
|
-
};
|
32854
|
-
return [receiptBurn, o];
|
32855
|
-
}
|
32856
|
-
};
|
32857
32718
|
var StorageSlotCoder = class extends StructCoder {
|
32858
32719
|
constructor() {
|
32859
32720
|
super("StorageSlot", {
|
@@ -37940,6 +37801,13 @@ ${MessageFragmentDoc}`;
|
|
37940
37801
|
submitAndAwait(tx: $encodedTransaction) {
|
37941
37802
|
...transactionStatusSubscriptionFragment
|
37942
37803
|
}
|
37804
|
+
}
|
37805
|
+
${TransactionStatusSubscriptionFragmentDoc}`;
|
37806
|
+
var SubmitAndAwaitStatusDocument = lib_default2`
|
37807
|
+
subscription submitAndAwaitStatus($encodedTransaction: HexString!) {
|
37808
|
+
submitAndAwaitStatus(tx: $encodedTransaction) {
|
37809
|
+
...transactionStatusSubscriptionFragment
|
37810
|
+
}
|
37943
37811
|
}
|
37944
37812
|
${TransactionStatusSubscriptionFragmentDoc}`;
|
37945
37813
|
var StatusChangeDocument = lib_default2`
|
@@ -38038,6 +37906,9 @@ ${MessageFragmentDoc}`;
|
|
38038
37906
|
submitAndAwait(variables, options) {
|
38039
37907
|
return requester(SubmitAndAwaitDocument, variables, options);
|
38040
37908
|
},
|
37909
|
+
submitAndAwaitStatus(variables, options) {
|
37910
|
+
return requester(SubmitAndAwaitStatusDocument, variables, options);
|
37911
|
+
},
|
38041
37912
|
statusChange(variables, options) {
|
38042
37913
|
return requester(StatusChangeDocument, variables, options);
|
38043
37914
|
}
|
@@ -38062,7 +37933,9 @@ ${MessageFragmentDoc}`;
|
|
38062
37933
|
Accept: "text/event-stream"
|
38063
37934
|
}
|
38064
37935
|
});
|
38065
|
-
|
37936
|
+
const [errorReader, resultReader] = response.body.tee().map((stream) => stream.getReader());
|
37937
|
+
await new _FuelGraphqlSubscriber(errorReader).next();
|
37938
|
+
return new _FuelGraphqlSubscriber(resultReader);
|
38066
37939
|
}
|
38067
37940
|
events = [];
|
38068
37941
|
parsingLeftover = "";
|
@@ -38105,10 +37978,8 @@ ${MessageFragmentDoc}`;
|
|
38105
37978
|
/**
|
38106
37979
|
* Gets called when `break` is called in a `for-await-of` loop.
|
38107
37980
|
*/
|
38108
|
-
|
38109
|
-
|
38110
|
-
this.stream.releaseLock();
|
38111
|
-
return { done: true, value: void 0 };
|
37981
|
+
return() {
|
37982
|
+
return Promise.resolve({ done: true, value: void 0 });
|
38112
37983
|
}
|
38113
37984
|
[Symbol.asyncIterator]() {
|
38114
37985
|
return this;
|
@@ -38528,12 +38399,12 @@ ${MessageFragmentDoc}`;
|
|
38528
38399
|
const amount = bn(receipt.amount);
|
38529
38400
|
const data = receipt.data ? arrayify(receipt.data) : Uint8Array.from([]);
|
38530
38401
|
const digest = hexOrZero(receipt.digest);
|
38531
|
-
const messageId =
|
38402
|
+
const messageId = InputMessageCoder.getMessageId({
|
38532
38403
|
sender,
|
38533
38404
|
recipient,
|
38534
38405
|
nonce,
|
38535
38406
|
amount,
|
38536
|
-
data
|
38407
|
+
data: hexlify(data)
|
38537
38408
|
});
|
38538
38409
|
const receiptMessageOut = {
|
38539
38410
|
type: ReceiptType.MessageOut,
|
@@ -38550,7 +38421,7 @@ ${MessageFragmentDoc}`;
|
|
38550
38421
|
case "MINT" /* Mint */: {
|
38551
38422
|
const contractId = hexOrZero(receipt.id || receipt.contractId);
|
38552
38423
|
const subId = hexOrZero(receipt.subId);
|
38553
|
-
const assetId =
|
38424
|
+
const assetId = getMintedAssetId(contractId, subId);
|
38554
38425
|
const mintReceipt = {
|
38555
38426
|
type: ReceiptType.Mint,
|
38556
38427
|
subId,
|
@@ -38565,7 +38436,7 @@ ${MessageFragmentDoc}`;
|
|
38565
38436
|
case "BURN" /* Burn */: {
|
38566
38437
|
const contractId = hexOrZero(receipt.id || receipt.contractId);
|
38567
38438
|
const subId = hexOrZero(receipt.subId);
|
38568
|
-
const assetId =
|
38439
|
+
const assetId = getMintedAssetId(contractId, subId);
|
38569
38440
|
const burnReceipt = {
|
38570
38441
|
type: ReceiptType.Burn,
|
38571
38442
|
subId,
|
@@ -40751,29 +40622,30 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
40751
40622
|
});
|
40752
40623
|
}
|
40753
40624
|
var TransactionResponse = class {
|
40754
|
-
/** Transaction ID */
|
40755
|
-
id;
|
40756
|
-
/** Current provider */
|
40757
|
-
provider;
|
40758
|
-
/** Gas used on the transaction */
|
40759
|
-
gasUsed = bn(0);
|
40760
|
-
/** The graphql Transaction with receipts object. */
|
40761
|
-
gqlTransaction;
|
40762
|
-
request;
|
40763
|
-
status;
|
40764
|
-
abis;
|
40765
40625
|
/**
|
40766
40626
|
* Constructor for `TransactionResponse`.
|
40767
40627
|
*
|
40768
40628
|
* @param tx - The transaction ID or TransactionRequest.
|
40769
40629
|
* @param provider - The provider.
|
40770
40630
|
*/
|
40771
|
-
constructor(tx, provider, abis) {
|
40631
|
+
constructor(tx, provider, abis, submitTxSubscription) {
|
40632
|
+
this.submitTxSubscription = submitTxSubscription;
|
40772
40633
|
this.id = typeof tx === "string" ? tx : tx.getTransactionId(provider.getChainId());
|
40773
40634
|
this.provider = provider;
|
40774
40635
|
this.abis = abis;
|
40775
40636
|
this.request = typeof tx === "string" ? void 0 : tx;
|
40776
40637
|
}
|
40638
|
+
/** Transaction ID */
|
40639
|
+
id;
|
40640
|
+
/** Current provider */
|
40641
|
+
provider;
|
40642
|
+
/** Gas used on the transaction */
|
40643
|
+
gasUsed = bn(0);
|
40644
|
+
/** The graphql Transaction with receipts object. */
|
40645
|
+
gqlTransaction;
|
40646
|
+
request;
|
40647
|
+
status;
|
40648
|
+
abis;
|
40777
40649
|
/**
|
40778
40650
|
* Async constructor for `TransactionResponse`. This method can be used to create
|
40779
40651
|
* an instance of `TransactionResponse` and wait for the transaction to be fetched
|
@@ -40906,10 +40778,11 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
40906
40778
|
if (status && status !== "SubmittedStatus") {
|
40907
40779
|
return;
|
40908
40780
|
}
|
40909
|
-
const subscription = await this.provider.operations.statusChange({
|
40781
|
+
const subscription = this.submitTxSubscription ?? await this.provider.operations.statusChange({
|
40910
40782
|
transactionId: this.id
|
40911
40783
|
});
|
40912
|
-
for await (const
|
40784
|
+
for await (const sub of subscription) {
|
40785
|
+
const statusChange = "statusChange" in sub ? sub.statusChange : sub.submitAndAwaitStatus;
|
40913
40786
|
this.status = statusChange;
|
40914
40787
|
if (statusChange.type === "SqueezedOutStatus") {
|
40915
40788
|
this.unsetResourceCache();
|
@@ -41185,7 +41058,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
|
|
41185
41058
|
const provider = new _Provider(urlToUse, {
|
41186
41059
|
...options,
|
41187
41060
|
requestMiddleware: async (request) => {
|
41188
|
-
if (auth) {
|
41061
|
+
if (auth && request) {
|
41189
41062
|
request.headers ??= {};
|
41190
41063
|
request.headers.Authorization = auth;
|
41191
41064
|
}
|
@@ -41445,11 +41318,9 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
41445
41318
|
if (isTransactionTypeScript(transactionRequest)) {
|
41446
41319
|
abis = transactionRequest.abis;
|
41447
41320
|
}
|
41448
|
-
const {
|
41449
|
-
|
41450
|
-
|
41451
|
-
__privateMethod(this, _cacheInputs, cacheInputs_fn).call(this, transactionRequest.inputs, transactionId);
|
41452
|
-
return new TransactionResponse(transactionRequest, this, abis);
|
41321
|
+
const subscription = await this.operations.submitAndAwaitStatus({ encodedTransaction });
|
41322
|
+
__privateMethod(this, _cacheInputs, cacheInputs_fn).call(this, transactionRequest.inputs, transactionRequest.getTransactionId(this.getChainId()));
|
41323
|
+
return new TransactionResponse(transactionRequest, this, abis, subscription);
|
41453
41324
|
}
|
41454
41325
|
/**
|
41455
41326
|
* Executes a transaction without actually submitting it to the chain.
|