@fuel-ts/account 0.0.0-rc-2037-20240411020051 → 0.0.0-rc-2040-20240411095959
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.
Potentially problematic release.
This version of @fuel-ts/account might be problematic. Click here for more details.
- package/dist/index.global.js +44 -25
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +34 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -23
- package/dist/index.mjs.map +1 -1
- package/dist/predicate/predicate.d.ts +1 -9
- package/dist/predicate/predicate.d.ts.map +1 -1
- package/dist/providers/coin.d.ts +1 -2
- package/dist/providers/coin.d.ts.map +1 -1
- package/dist/providers/message.d.ts +0 -1
- package/dist/providers/message.d.ts.map +1 -1
- package/dist/providers/transaction-request/transaction-request.d.ts +20 -2
- package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
- package/dist/test-utils.global.js +44 -10
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +34 -8
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +34 -8
- package/dist/test-utils.mjs.map +1 -1
- package/package.json +16 -16
package/dist/index.js
CHANGED
@@ -2035,8 +2035,8 @@ var BaseTransactionRequest = class {
|
|
2035
2035
|
* @param predicate - Predicate bytes.
|
2036
2036
|
* @param predicateData - Predicate data bytes.
|
2037
2037
|
*/
|
2038
|
-
addCoinInput(coin) {
|
2039
|
-
const { assetId, owner, amount
|
2038
|
+
addCoinInput(coin, predicate) {
|
2039
|
+
const { assetId, owner, amount } = coin;
|
2040
2040
|
let witnessIndex;
|
2041
2041
|
if (predicate) {
|
2042
2042
|
witnessIndex = 0;
|
@@ -2047,14 +2047,14 @@ var BaseTransactionRequest = class {
|
|
2047
2047
|
}
|
2048
2048
|
}
|
2049
2049
|
const input = {
|
2050
|
-
|
2050
|
+
...coin,
|
2051
2051
|
type: import_transactions6.InputType.Coin,
|
2052
2052
|
owner: owner.toB256(),
|
2053
2053
|
amount,
|
2054
2054
|
assetId,
|
2055
2055
|
txPointer: "0x00000000000000000000000000000000",
|
2056
2056
|
witnessIndex,
|
2057
|
-
predicate
|
2057
|
+
predicate: predicate?.bytes
|
2058
2058
|
};
|
2059
2059
|
this.pushInput(input);
|
2060
2060
|
this.addChangeOutput(owner, assetId);
|
@@ -2067,8 +2067,8 @@ var BaseTransactionRequest = class {
|
|
2067
2067
|
* @param predicate - Predicate bytes.
|
2068
2068
|
* @param predicateData - Predicate data bytes.
|
2069
2069
|
*/
|
2070
|
-
addMessageInput(message) {
|
2071
|
-
const { recipient, sender, amount
|
2070
|
+
addMessageInput(message, predicate) {
|
2071
|
+
const { recipient, sender, amount } = message;
|
2072
2072
|
const assetId = import_configs7.BaseAssetId;
|
2073
2073
|
let witnessIndex;
|
2074
2074
|
if (predicate) {
|
@@ -2080,13 +2080,13 @@ var BaseTransactionRequest = class {
|
|
2080
2080
|
}
|
2081
2081
|
}
|
2082
2082
|
const input = {
|
2083
|
-
|
2083
|
+
...message,
|
2084
2084
|
type: import_transactions6.InputType.Message,
|
2085
2085
|
sender: sender.toB256(),
|
2086
2086
|
recipient: recipient.toB256(),
|
2087
2087
|
amount,
|
2088
2088
|
witnessIndex,
|
2089
|
-
predicate
|
2089
|
+
predicate: predicate?.bytes
|
2090
2090
|
};
|
2091
2091
|
this.pushInput(input);
|
2092
2092
|
this.addChangeOutput(recipient, assetId);
|
@@ -2117,6 +2117,32 @@ var BaseTransactionRequest = class {
|
|
2117
2117
|
resources.forEach((resource) => this.addResource(resource));
|
2118
2118
|
return this;
|
2119
2119
|
}
|
2120
|
+
/**
|
2121
|
+
* Adds multiple resources to the transaction by adding coin/message inputs and change
|
2122
|
+
* outputs from the related assetIds.
|
2123
|
+
*
|
2124
|
+
* @param resources - The resources to add.
|
2125
|
+
* @returns This transaction.
|
2126
|
+
*/
|
2127
|
+
addPredicateResource(resource, predicate) {
|
2128
|
+
if (isCoin(resource)) {
|
2129
|
+
this.addCoinInput(resource, predicate);
|
2130
|
+
} else {
|
2131
|
+
this.addMessageInput(resource, predicate);
|
2132
|
+
}
|
2133
|
+
return this;
|
2134
|
+
}
|
2135
|
+
/**
|
2136
|
+
* Adds multiple predicate coin/message inputs to the transaction and change outputs
|
2137
|
+
* from the related assetIds.
|
2138
|
+
*
|
2139
|
+
* @param resources - The resources to add.
|
2140
|
+
* @returns This transaction.
|
2141
|
+
*/
|
2142
|
+
addPredicateResources(resources, predicate) {
|
2143
|
+
resources.forEach((resource) => this.addPredicateResource(resource, predicate));
|
2144
|
+
return this;
|
2145
|
+
}
|
2120
2146
|
/**
|
2121
2147
|
* Adds a coin output to the transaction.
|
2122
2148
|
*
|
@@ -8832,7 +8858,6 @@ var Predicate = class extends Account {
|
|
8832
8858
|
if (input.type === import_transactions20.InputType.Coin && (0, import_utils37.hexlify)(input.owner) === this.address.toB256()) {
|
8833
8859
|
input.predicate = this.bytes;
|
8834
8860
|
input.predicateData = this.getPredicateData(policies.length);
|
8835
|
-
input.witnessIndex = 0;
|
8836
8861
|
}
|
8837
8862
|
});
|
8838
8863
|
return request;
|
@@ -8870,20 +8895,6 @@ var Predicate = class extends Account {
|
|
8870
8895
|
const transactionRequest = this.populateTransactionPredicateData(transactionRequestLike);
|
8871
8896
|
return super.simulateTransaction(transactionRequest);
|
8872
8897
|
}
|
8873
|
-
/**
|
8874
|
-
* Retrieves resources satisfying the spend query for the account.
|
8875
|
-
*
|
8876
|
-
* @param quantities - IDs of coins to exclude.
|
8877
|
-
* @param excludedIds - IDs of resources to be excluded from the query.
|
8878
|
-
* @returns A promise that resolves to an array of Resources.
|
8879
|
-
*/
|
8880
|
-
async getResourcesToSpend(quantities, excludedIds) {
|
8881
|
-
const resources = await super.getResourcesToSpend(quantities, excludedIds);
|
8882
|
-
return resources.map((resource) => ({
|
8883
|
-
...resource,
|
8884
|
-
predicate: (0, import_utils37.hexlify)(this.bytes)
|
8885
|
-
}));
|
8886
|
-
}
|
8887
8898
|
getPredicateData(policiesLength) {
|
8888
8899
|
if (!this.predicateData.length) {
|
8889
8900
|
return new Uint8Array();
|