@fuel-ts/account 0.0.0-pr-1699-20240214162434 → 0.0.0-pr-1788-20240222085506
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/account.d.ts +8 -6
- package/dist/account.d.ts.map +1 -1
- package/dist/connectors/fuel.d.ts +5 -6
- package/dist/connectors/fuel.d.ts.map +1 -1
- package/dist/connectors/index.d.ts +0 -2
- package/dist/connectors/index.d.ts.map +1 -1
- package/dist/connectors/types/asset.d.ts +0 -14
- package/dist/connectors/types/asset.d.ts.map +1 -1
- package/dist/connectors/types/data-type.d.ts +0 -4
- package/dist/connectors/types/data-type.d.ts.map +1 -1
- package/dist/connectors/types/events.d.ts +0 -5
- package/dist/connectors/types/events.d.ts.map +1 -1
- package/dist/connectors/types/index.d.ts +0 -2
- package/dist/connectors/types/index.d.ts.map +1 -1
- package/dist/connectors/utils/cache.d.ts.map +1 -1
- package/dist/connectors/utils/index.d.ts +0 -1
- package/dist/connectors/utils/index.d.ts.map +1 -1
- package/dist/hdwallet/hdwallet.d.ts +1 -1
- package/dist/hdwallet/hdwallet.d.ts.map +1 -1
- package/dist/index.global.js +898 -785
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +460 -344
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +388 -284
- package/dist/index.mjs.map +1 -1
- package/dist/mnemonic/mnemonic.d.ts +1 -1
- package/dist/mnemonic/mnemonic.d.ts.map +1 -1
- package/dist/mnemonic/utils.d.ts +1 -1
- package/dist/mnemonic/utils.d.ts.map +1 -1
- package/dist/predicate/predicate.d.ts.map +1 -1
- package/dist/predicate/utils/getPredicateRoot.d.ts +1 -1
- package/dist/predicate/utils/getPredicateRoot.d.ts.map +1 -1
- package/dist/providers/assets/index.d.ts +4 -0
- package/dist/providers/assets/index.d.ts.map +1 -0
- package/dist/providers/assets/types.d.ts +36 -0
- package/dist/providers/assets/types.d.ts.map +1 -0
- package/dist/providers/assets/utils/index.d.ts +4 -0
- package/dist/providers/assets/utils/index.d.ts.map +1 -0
- package/dist/providers/assets/utils/network.d.ts +33 -0
- package/dist/providers/assets/utils/network.d.ts.map +1 -0
- package/dist/providers/assets/utils/resolveIconPaths.d.ts +14 -0
- package/dist/providers/assets/utils/resolveIconPaths.d.ts.map +1 -0
- package/dist/providers/assets/utils/url.d.ts +2 -0
- package/dist/providers/assets/utils/url.d.ts.map +1 -0
- package/dist/providers/chains.d.ts +11 -0
- package/dist/providers/chains.d.ts.map +1 -0
- package/dist/providers/coin-quantity.d.ts +1 -1
- package/dist/providers/coin-quantity.d.ts.map +1 -1
- package/dist/providers/index.d.ts +2 -0
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/memory-cache.d.ts +1 -1
- package/dist/providers/memory-cache.d.ts.map +1 -1
- package/dist/providers/message.d.ts +1 -2
- package/dist/providers/message.d.ts.map +1 -1
- package/dist/providers/provider.d.ts +14 -7
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/resource.d.ts +1 -1
- package/dist/providers/resource.d.ts.map +1 -1
- package/dist/providers/transaction-request/create-transaction-request.d.ts +1 -1
- package/dist/providers/transaction-request/create-transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/hash-transaction.d.ts.map +1 -1
- package/dist/providers/transaction-request/input.d.ts +1 -1
- package/dist/providers/transaction-request/input.d.ts.map +1 -1
- package/dist/providers/transaction-request/output.d.ts +1 -1
- package/dist/providers/transaction-request/output.d.ts.map +1 -1
- package/dist/providers/transaction-request/script-transaction-request.d.ts +1 -2
- package/dist/providers/transaction-request/script-transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/storage-slot.d.ts +1 -1
- package/dist/providers/transaction-request/storage-slot.d.ts.map +1 -1
- package/dist/providers/transaction-request/transaction-request.d.ts +3 -11
- package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/witness.d.ts +1 -1
- package/dist/providers/transaction-request/witness.d.ts.map +1 -1
- package/dist/providers/utils/gas.d.ts.map +1 -1
- package/dist/providers/utils/json.d.ts.map +1 -1
- package/dist/signer/signer.d.ts +1 -1
- package/dist/signer/signer.d.ts.map +1 -1
- package/dist/test-utils/launchNode.d.ts.map +1 -1
- package/dist/test-utils.global.js +3319 -3222
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +349 -252
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +283 -198
- package/dist/test-utils.mjs.map +1 -1
- package/dist/utils/formatTransferToContractScriptData.d.ts +1 -2
- package/dist/utils/formatTransferToContractScriptData.d.ts.map +1 -1
- package/dist/wallet/base-wallet-unlocked.d.ts +4 -4
- package/dist/wallet/base-wallet-unlocked.d.ts.map +1 -1
- package/dist/wallet/wallet.d.ts +1 -2
- package/dist/wallet/wallet.d.ts.map +1 -1
- package/dist/wallet/wallets.d.ts +1 -1
- package/dist/wallet/wallets.d.ts.map +1 -1
- package/package.json +17 -17
- package/dist/connectors/fixtures/generate-accounts.d.ts +0 -2
- package/dist/connectors/fixtures/generate-accounts.d.ts.map +0 -1
- package/dist/connectors/fixtures/mocked-connector.d.ts +0 -45
- package/dist/connectors/fixtures/mocked-connector.d.ts.map +0 -1
- package/dist/connectors/fixtures/promise-callback.d.ts +0 -7
- package/dist/connectors/fixtures/promise-callback.d.ts.map +0 -1
- package/dist/connectors/fuel-wallet-locked.d.ts +0 -13
- package/dist/connectors/fuel-wallet-locked.d.ts.map +0 -1
- package/dist/connectors/fuel-wallet-provider.d.ts +0 -14
- package/dist/connectors/fuel-wallet-provider.d.ts.map +0 -1
- package/dist/connectors/types/connection.d.ts +0 -7
- package/dist/connectors/types/connection.d.ts.map +0 -1
- package/dist/connectors/types/nertwork-data.d.ts +0 -7
- package/dist/connectors/types/nertwork-data.d.ts.map +0 -1
- package/dist/connectors/utils/get-asset-by-chain.d.ts +0 -3
- package/dist/connectors/utils/get-asset-by-chain.d.ts.map +0 -1
package/dist/index.js
CHANGED
@@ -59,22 +59,17 @@ var src_exports = {};
|
|
59
59
|
__export(src_exports, {
|
60
60
|
Account: () => Account,
|
61
61
|
AddressType: () => AddressType,
|
62
|
-
BACKGROUND_SCRIPT_NAME: () => BACKGROUND_SCRIPT_NAME,
|
63
62
|
BaseTransactionRequest: () => BaseTransactionRequest,
|
64
63
|
BaseWalletUnlocked: () => BaseWalletUnlocked,
|
65
|
-
|
66
|
-
CONTENT_SCRIPT_NAME: () => CONTENT_SCRIPT_NAME,
|
64
|
+
CHAIN_IDS: () => CHAIN_IDS,
|
67
65
|
ChainName: () => ChainName,
|
68
66
|
ChangeOutputCollisionError: () => ChangeOutputCollisionError,
|
69
67
|
CreateTransactionRequest: () => CreateTransactionRequest,
|
70
|
-
EVENT_MESSAGE: () => EVENT_MESSAGE,
|
71
68
|
Fuel: () => Fuel,
|
72
69
|
FuelConnector: () => FuelConnector,
|
73
70
|
FuelConnectorEventType: () => FuelConnectorEventType,
|
74
71
|
FuelConnectorEventTypes: () => FuelConnectorEventTypes,
|
75
72
|
FuelConnectorMethods: () => FuelConnectorMethods,
|
76
|
-
FuelWalletLocked: () => FuelWalletLocked,
|
77
|
-
FuelWalletProvider: () => FuelWalletProvider,
|
78
73
|
HDWallet: () => hdwallet_default,
|
79
74
|
Language: () => Language,
|
80
75
|
LocalStorage: () => LocalStorage,
|
@@ -86,7 +81,6 @@ __export(src_exports, {
|
|
86
81
|
NoWitnessAtIndexError: () => NoWitnessAtIndexError,
|
87
82
|
NoWitnessByOwnerError: () => NoWitnessByOwnerError,
|
88
83
|
OperationName: () => OperationName,
|
89
|
-
POPUP_SCRIPT_NAME: () => POPUP_SCRIPT_NAME,
|
90
84
|
Predicate: () => Predicate,
|
91
85
|
PrivateKeyVault: () => PrivateKeyVault,
|
92
86
|
Provider: () => Provider,
|
@@ -97,7 +91,6 @@ __export(src_exports, {
|
|
97
91
|
TransactionStatus: () => TransactionStatus,
|
98
92
|
TransactionType: () => import_transactions5.TransactionType,
|
99
93
|
TransactionTypeName: () => TransactionTypeName,
|
100
|
-
VAULT_SCRIPT_NAME: () => VAULT_SCRIPT_NAME,
|
101
94
|
Vault: () => Vault,
|
102
95
|
Wallet: () => Wallet,
|
103
96
|
WalletLocked: () => WalletLocked,
|
@@ -107,6 +100,7 @@ __export(src_exports, {
|
|
107
100
|
addOperation: () => addOperation,
|
108
101
|
assembleReceiptByType: () => assembleReceiptByType,
|
109
102
|
assembleTransactionSummary: () => assembleTransactionSummary,
|
103
|
+
assets: () => assets,
|
110
104
|
buildBlockExplorerUrl: () => buildBlockExplorerUrl,
|
111
105
|
cacheFor: () => cacheFor,
|
112
106
|
calculateMetadataGasForTxCreate: () => calculateMetadataGasForTxCreate,
|
@@ -124,11 +118,15 @@ __export(src_exports, {
|
|
124
118
|
fromTai64ToUnix: () => fromTai64ToUnix,
|
125
119
|
fromUnixToTai64: () => fromUnixToTai64,
|
126
120
|
gasUsedByInputs: () => gasUsedByInputs,
|
127
|
-
|
121
|
+
getAssetEth: () => getAssetEth,
|
122
|
+
getAssetFuel: () => getAssetFuel,
|
123
|
+
getAssetNetwork: () => getAssetNetwork,
|
124
|
+
getAssetWithNetwork: () => getAssetWithNetwork,
|
128
125
|
getContractCallOperations: () => getContractCallOperations,
|
129
126
|
getContractCreatedOperations: () => getContractCreatedOperations,
|
130
127
|
getContractTransferOperations: () => getContractTransferOperations,
|
131
128
|
getDecodedLogs: () => getDecodedLogs,
|
129
|
+
getDefaultChainId: () => getDefaultChainId,
|
132
130
|
getGasUsedFromReceipts: () => getGasUsedFromReceipts,
|
133
131
|
getInputAccountAddress: () => getInputAccountAddress,
|
134
132
|
getInputContractFromIndex: () => getInputContractFromIndex,
|
@@ -177,9 +175,11 @@ __export(src_exports, {
|
|
177
175
|
processGqlReceipt: () => processGqlReceipt,
|
178
176
|
processGraphqlStatus: () => processGraphqlStatus,
|
179
177
|
resolveGasDependentCosts: () => resolveGasDependentCosts,
|
178
|
+
resolveIconPaths: () => resolveIconPaths,
|
180
179
|
returnZeroScript: () => returnZeroScript,
|
181
180
|
sleep: () => sleep,
|
182
181
|
transactionRequestify: () => transactionRequestify,
|
182
|
+
urlJoin: () => urlJoin,
|
183
183
|
withTimeout: () => withTimeout,
|
184
184
|
withdrawScript: () => withdrawScript
|
185
185
|
});
|
@@ -191,12 +191,12 @@ var import_configs10 = require("@fuel-ts/address/configs");
|
|
191
191
|
var import_errors15 = require("@fuel-ts/errors");
|
192
192
|
var import_interfaces = require("@fuel-ts/interfaces");
|
193
193
|
var import_math17 = require("@fuel-ts/math");
|
194
|
-
var
|
194
|
+
var import_utils27 = require("@fuel-ts/utils");
|
195
195
|
|
196
196
|
// src/providers/coin-quantity.ts
|
197
197
|
var import_configs = require("@fuel-ts/address/configs");
|
198
198
|
var import_math = require("@fuel-ts/math");
|
199
|
-
var
|
199
|
+
var import_utils = require("@fuel-ts/utils");
|
200
200
|
var coinQuantityfy = (coinQuantityLike) => {
|
201
201
|
let assetId;
|
202
202
|
let amount;
|
@@ -212,7 +212,7 @@ var coinQuantityfy = (coinQuantityLike) => {
|
|
212
212
|
}
|
213
213
|
const bnAmount = (0, import_math.bn)(amount);
|
214
214
|
return {
|
215
|
-
assetId: (0,
|
215
|
+
assetId: (0, import_utils.hexlify)(assetId),
|
216
216
|
amount: bnAmount.lt(1) ? (0, import_math.bn)(1) : bnAmount,
|
217
217
|
max: max2 ? (0, import_math.bn)(max2) : void 0
|
218
218
|
};
|
@@ -234,8 +234,10 @@ var import_address3 = require("@fuel-ts/address");
|
|
234
234
|
var import_errors13 = require("@fuel-ts/errors");
|
235
235
|
var import_math14 = require("@fuel-ts/math");
|
236
236
|
var import_transactions17 = require("@fuel-ts/transactions");
|
237
|
+
var import_utils22 = require("@fuel-ts/utils");
|
237
238
|
var import_versions = require("@fuel-ts/versions");
|
238
|
-
var
|
239
|
+
var import_utils23 = require("@noble/curves/abstract/utils");
|
240
|
+
var import_ethers2 = require("ethers");
|
239
241
|
var import_graphql_request = require("graphql-request");
|
240
242
|
var import_ramda3 = require("ramda");
|
241
243
|
|
@@ -1108,7 +1110,7 @@ async function* fuelGraphQLSubscriber({
|
|
1108
1110
|
|
1109
1111
|
// src/providers/memory-cache.ts
|
1110
1112
|
var import_errors2 = require("@fuel-ts/errors");
|
1111
|
-
var
|
1113
|
+
var import_utils2 = require("@fuel-ts/utils");
|
1112
1114
|
var cache = {};
|
1113
1115
|
var DEFAULT_TTL_IN_MS = 30 * 1e3;
|
1114
1116
|
var MemoryCache = class {
|
@@ -1123,7 +1125,7 @@ var MemoryCache = class {
|
|
1123
1125
|
}
|
1124
1126
|
}
|
1125
1127
|
get(value, isAutoExpiring = true) {
|
1126
|
-
const key = (0,
|
1128
|
+
const key = (0, import_utils2.hexlify)(value);
|
1127
1129
|
if (cache[key]) {
|
1128
1130
|
if (!isAutoExpiring || cache[key].expires > Date.now()) {
|
1129
1131
|
return cache[key].value;
|
@@ -1134,7 +1136,7 @@ var MemoryCache = class {
|
|
1134
1136
|
}
|
1135
1137
|
set(value) {
|
1136
1138
|
const expiresAt = Date.now() + this.ttl;
|
1137
|
-
const key = (0,
|
1139
|
+
const key = (0, import_utils2.hexlify)(value);
|
1138
1140
|
cache[key] = {
|
1139
1141
|
expires: expiresAt,
|
1140
1142
|
value
|
@@ -1160,7 +1162,7 @@ var MemoryCache = class {
|
|
1160
1162
|
}, []);
|
1161
1163
|
}
|
1162
1164
|
del(value) {
|
1163
|
-
const key = (0,
|
1165
|
+
const key = (0, import_utils2.hexlify)(value);
|
1164
1166
|
delete cache[key];
|
1165
1167
|
}
|
1166
1168
|
};
|
@@ -1170,31 +1172,31 @@ var import_configs2 = require("@fuel-ts/address/configs");
|
|
1170
1172
|
var import_errors3 = require("@fuel-ts/errors");
|
1171
1173
|
var import_math2 = require("@fuel-ts/math");
|
1172
1174
|
var import_transactions = require("@fuel-ts/transactions");
|
1173
|
-
var
|
1175
|
+
var import_utils3 = require("@fuel-ts/utils");
|
1174
1176
|
var inputify = (value) => {
|
1175
1177
|
const { type } = value;
|
1176
1178
|
switch (value.type) {
|
1177
1179
|
case import_transactions.InputType.Coin: {
|
1178
|
-
const predicate = (0,
|
1179
|
-
const predicateData = (0,
|
1180
|
+
const predicate = (0, import_utils3.arrayify)(value.predicate ?? "0x");
|
1181
|
+
const predicateData = (0, import_utils3.arrayify)(value.predicateData ?? "0x");
|
1180
1182
|
return {
|
1181
1183
|
type: import_transactions.InputType.Coin,
|
1182
|
-
txID: (0,
|
1183
|
-
outputIndex: (0,
|
1184
|
-
owner: (0,
|
1184
|
+
txID: (0, import_utils3.hexlify)((0, import_utils3.arrayify)(value.id).slice(0, 32)),
|
1185
|
+
outputIndex: (0, import_utils3.arrayify)(value.id)[32],
|
1186
|
+
owner: (0, import_utils3.hexlify)(value.owner),
|
1185
1187
|
amount: (0, import_math2.bn)(value.amount),
|
1186
|
-
assetId: (0,
|
1188
|
+
assetId: (0, import_utils3.hexlify)(value.assetId),
|
1187
1189
|
txPointer: {
|
1188
|
-
blockHeight: (0, import_math2.toNumber)((0,
|
1189
|
-
txIndex: (0, import_math2.toNumber)((0,
|
1190
|
+
blockHeight: (0, import_math2.toNumber)((0, import_utils3.arrayify)(value.txPointer).slice(0, 8)),
|
1191
|
+
txIndex: (0, import_math2.toNumber)((0, import_utils3.arrayify)(value.txPointer).slice(8, 16))
|
1190
1192
|
},
|
1191
1193
|
witnessIndex: value.witnessIndex,
|
1192
1194
|
maturity: value.maturity ?? 0,
|
1193
1195
|
predicateGasUsed: (0, import_math2.bn)(value.predicateGasUsed),
|
1194
1196
|
predicateLength: predicate.length,
|
1195
1197
|
predicateDataLength: predicateData.length,
|
1196
|
-
predicate: (0,
|
1197
|
-
predicateData: (0,
|
1198
|
+
predicate: (0, import_utils3.hexlify)(predicate),
|
1199
|
+
predicateData: (0, import_utils3.hexlify)(predicateData)
|
1198
1200
|
};
|
1199
1201
|
}
|
1200
1202
|
case import_transactions.InputType.Contract: {
|
@@ -1205,29 +1207,29 @@ var inputify = (value) => {
|
|
1205
1207
|
balanceRoot: import_configs2.ZeroBytes32,
|
1206
1208
|
stateRoot: import_configs2.ZeroBytes32,
|
1207
1209
|
txPointer: {
|
1208
|
-
blockHeight: (0, import_math2.toNumber)((0,
|
1209
|
-
txIndex: (0, import_math2.toNumber)((0,
|
1210
|
+
blockHeight: (0, import_math2.toNumber)((0, import_utils3.arrayify)(value.txPointer).slice(0, 8)),
|
1211
|
+
txIndex: (0, import_math2.toNumber)((0, import_utils3.arrayify)(value.txPointer).slice(8, 16))
|
1210
1212
|
},
|
1211
|
-
contractID: (0,
|
1213
|
+
contractID: (0, import_utils3.hexlify)(value.contractId)
|
1212
1214
|
};
|
1213
1215
|
}
|
1214
1216
|
case import_transactions.InputType.Message: {
|
1215
|
-
const predicate = (0,
|
1216
|
-
const predicateData = (0,
|
1217
|
-
const data = (0,
|
1217
|
+
const predicate = (0, import_utils3.arrayify)(value.predicate ?? "0x");
|
1218
|
+
const predicateData = (0, import_utils3.arrayify)(value.predicateData ?? "0x");
|
1219
|
+
const data = (0, import_utils3.arrayify)(value.data ?? "0x");
|
1218
1220
|
return {
|
1219
1221
|
type: import_transactions.InputType.Message,
|
1220
|
-
sender: (0,
|
1221
|
-
recipient: (0,
|
1222
|
+
sender: (0, import_utils3.hexlify)(value.sender),
|
1223
|
+
recipient: (0, import_utils3.hexlify)(value.recipient),
|
1222
1224
|
amount: (0, import_math2.bn)(value.amount),
|
1223
|
-
nonce: (0,
|
1225
|
+
nonce: (0, import_utils3.hexlify)(value.nonce),
|
1224
1226
|
witnessIndex: value.witnessIndex,
|
1225
1227
|
predicateGasUsed: (0, import_math2.bn)(value.predicateGasUsed),
|
1226
1228
|
predicateLength: predicate.length,
|
1227
1229
|
predicateDataLength: predicateData.length,
|
1228
|
-
predicate: (0,
|
1229
|
-
predicateData: (0,
|
1230
|
-
data: (0,
|
1230
|
+
predicate: (0, import_utils3.hexlify)(predicate),
|
1231
|
+
predicateData: (0, import_utils3.hexlify)(predicateData),
|
1232
|
+
data: (0, import_utils3.hexlify)(data),
|
1231
1233
|
dataLength: data.length
|
1232
1234
|
};
|
1233
1235
|
}
|
@@ -1245,16 +1247,16 @@ var import_configs3 = require("@fuel-ts/address/configs");
|
|
1245
1247
|
var import_errors4 = require("@fuel-ts/errors");
|
1246
1248
|
var import_math3 = require("@fuel-ts/math");
|
1247
1249
|
var import_transactions2 = require("@fuel-ts/transactions");
|
1248
|
-
var
|
1250
|
+
var import_utils4 = require("@fuel-ts/utils");
|
1249
1251
|
var outputify = (value) => {
|
1250
1252
|
const { type } = value;
|
1251
1253
|
switch (type) {
|
1252
1254
|
case import_transactions2.OutputType.Coin: {
|
1253
1255
|
return {
|
1254
1256
|
type: import_transactions2.OutputType.Coin,
|
1255
|
-
to: (0,
|
1257
|
+
to: (0, import_utils4.hexlify)(value.to),
|
1256
1258
|
amount: (0, import_math3.bn)(value.amount),
|
1257
|
-
assetId: (0,
|
1259
|
+
assetId: (0, import_utils4.hexlify)(value.assetId)
|
1258
1260
|
};
|
1259
1261
|
}
|
1260
1262
|
case import_transactions2.OutputType.Contract: {
|
@@ -1268,9 +1270,9 @@ var outputify = (value) => {
|
|
1268
1270
|
case import_transactions2.OutputType.Change: {
|
1269
1271
|
return {
|
1270
1272
|
type: import_transactions2.OutputType.Change,
|
1271
|
-
to: (0,
|
1273
|
+
to: (0, import_utils4.hexlify)(value.to),
|
1272
1274
|
amount: (0, import_math3.bn)(0),
|
1273
|
-
assetId: (0,
|
1275
|
+
assetId: (0, import_utils4.hexlify)(value.assetId)
|
1274
1276
|
};
|
1275
1277
|
}
|
1276
1278
|
case import_transactions2.OutputType.Variable: {
|
@@ -1284,8 +1286,8 @@ var outputify = (value) => {
|
|
1284
1286
|
case import_transactions2.OutputType.ContractCreated: {
|
1285
1287
|
return {
|
1286
1288
|
type: import_transactions2.OutputType.ContractCreated,
|
1287
|
-
contractId: (0,
|
1288
|
-
stateRoot: (0,
|
1289
|
+
contractId: (0, import_utils4.hexlify)(value.contractId),
|
1290
|
+
stateRoot: (0, import_utils4.hexlify)(value.stateRoot)
|
1289
1291
|
};
|
1290
1292
|
}
|
1291
1293
|
default: {
|
@@ -1302,7 +1304,7 @@ var import_address = require("@fuel-ts/address");
|
|
1302
1304
|
var import_configs6 = require("@fuel-ts/address/configs");
|
1303
1305
|
var import_math6 = require("@fuel-ts/math");
|
1304
1306
|
var import_transactions5 = require("@fuel-ts/transactions");
|
1305
|
-
var
|
1307
|
+
var import_utils9 = require("@fuel-ts/utils");
|
1306
1308
|
|
1307
1309
|
// src/providers/resource.ts
|
1308
1310
|
var isRawCoin = (resource) => "utxoId" in resource;
|
@@ -1316,7 +1318,7 @@ var import_errors5 = require("@fuel-ts/errors");
|
|
1316
1318
|
var import_math4 = require("@fuel-ts/math");
|
1317
1319
|
var import_transactions3 = require("@fuel-ts/transactions");
|
1318
1320
|
var import_configs5 = require("@fuel-ts/transactions/configs");
|
1319
|
-
var
|
1321
|
+
var import_utils5 = require("@fuel-ts/utils");
|
1320
1322
|
var doesReceiptHaveMissingOutputVariables = (receipt) => receipt.type === import_transactions3.ReceiptType.Revert && receipt.val.toString("hex") === import_configs5.FAILED_TRANSFER_TO_ADDRESS_SIGNAL;
|
1321
1323
|
var doesReceiptHaveMissingContractId = (receipt) => receipt.type === import_transactions3.ReceiptType.Panic && receipt.contractId !== "0x0000000000000000000000000000000000000000000000000000000000000000";
|
1322
1324
|
var getReceiptsWithMissingData = (receipts) => receipts.reduce(
|
@@ -1460,7 +1462,7 @@ function assembleReceiptByType(receipt) {
|
|
1460
1462
|
const recipient = hexOrZero(receipt.recipient);
|
1461
1463
|
const nonce = hexOrZero(receipt.nonce);
|
1462
1464
|
const amount = (0, import_math4.bn)(receipt.amount);
|
1463
|
-
const data = receipt.data ? (0,
|
1465
|
+
const data = receipt.data ? (0, import_utils5.arrayify)(receipt.data) : Uint8Array.from([]);
|
1464
1466
|
const digest = hexOrZero(receipt.digest);
|
1465
1467
|
const messageId = import_transactions3.ReceiptMessageOutCoder.getMessageId({
|
1466
1468
|
sender,
|
@@ -1581,7 +1583,7 @@ var buildBlockExplorerUrl = (options = {}) => {
|
|
1581
1583
|
// src/providers/utils/gas.ts
|
1582
1584
|
var import_math5 = require("@fuel-ts/math");
|
1583
1585
|
var import_transactions4 = require("@fuel-ts/transactions");
|
1584
|
-
var
|
1586
|
+
var import_utils6 = require("@fuel-ts/utils");
|
1585
1587
|
var calculatePriceWithFactor = (gas, gasPrice, priceFactor) => (0, import_math5.bn)(Math.ceil(gas.mul(gasPrice).toNumber() / priceFactor.toNumber()));
|
1586
1588
|
var getGasUsedFromReceipts = (receipts) => {
|
1587
1589
|
const scriptResult = receipts.filter(
|
@@ -1606,9 +1608,7 @@ function gasUsedByInputs(inputs, txBytesSize, gasCosts) {
|
|
1606
1608
|
const totalGas = inputs.reduce((total, input) => {
|
1607
1609
|
if ("predicate" in input && input.predicate && input.predicate !== "0x") {
|
1608
1610
|
return total.add(
|
1609
|
-
resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization).add(
|
1610
|
-
resolveGasDependentCosts((0, import_ethers6.getBytesCopy)(input.predicate).length, gasCosts.contractRoot)
|
1611
|
-
).add((0, import_math5.bn)(input.predicateGasUsed))
|
1611
|
+
resolveGasDependentCosts(txBytesSize, gasCosts.vmInitialization).add(resolveGasDependentCosts((0, import_utils6.arrayify)(input.predicate).length, gasCosts.contractRoot)).add((0, import_math5.bn)(input.predicateGasUsed))
|
1612
1612
|
);
|
1613
1613
|
}
|
1614
1614
|
if ("witnessIndex" in input && !witnessCache.includes(input.witnessIndex)) {
|
@@ -1657,13 +1657,13 @@ function calculateMetadataGasForTxScript({
|
|
1657
1657
|
}
|
1658
1658
|
|
1659
1659
|
// src/providers/utils/json.ts
|
1660
|
-
var
|
1660
|
+
var import_utils7 = require("@fuel-ts/utils");
|
1661
1661
|
var import_ramda = require("ramda");
|
1662
1662
|
function normalize(object) {
|
1663
1663
|
Object.keys(object).forEach((key) => {
|
1664
1664
|
switch (object[key]?.constructor.name) {
|
1665
1665
|
case "Uint8Array":
|
1666
|
-
object[key] = (0,
|
1666
|
+
object[key] = (0, import_utils7.hexlify)(object[key]);
|
1667
1667
|
break;
|
1668
1668
|
case "Array":
|
1669
1669
|
object[key] = normalize(object[key]);
|
@@ -1723,11 +1723,11 @@ var NoWitnessByOwnerError = class extends Error {
|
|
1723
1723
|
};
|
1724
1724
|
|
1725
1725
|
// src/providers/transaction-request/witness.ts
|
1726
|
-
var
|
1726
|
+
var import_utils8 = require("@fuel-ts/utils");
|
1727
1727
|
var witnessify = (value) => {
|
1728
|
-
const data = (0,
|
1728
|
+
const data = (0, import_utils8.arrayify)(value);
|
1729
1729
|
return {
|
1730
|
-
data: (0,
|
1730
|
+
data: (0, import_utils8.hexlify)(data),
|
1731
1731
|
dataLength: data.length
|
1732
1732
|
};
|
1733
1733
|
};
|
@@ -1847,7 +1847,7 @@ var BaseTransactionRequest = class {
|
|
1847
1847
|
* Creates an empty witness without any side effects and returns the index
|
1848
1848
|
*/
|
1849
1849
|
createWitness() {
|
1850
|
-
this.witnesses.push((0,
|
1850
|
+
this.witnesses.push((0, import_utils9.concat)([import_configs6.ZeroBytes32, import_configs6.ZeroBytes32]));
|
1851
1851
|
return this.witnesses.length - 1;
|
1852
1852
|
}
|
1853
1853
|
/**
|
@@ -1916,9 +1916,9 @@ var BaseTransactionRequest = class {
|
|
1916
1916
|
const found = this.inputs.find((input) => {
|
1917
1917
|
switch (input.type) {
|
1918
1918
|
case import_transactions5.InputType.Coin:
|
1919
|
-
return (0,
|
1919
|
+
return (0, import_utils9.hexlify)(input.owner) === ownerAddress.toB256();
|
1920
1920
|
case import_transactions5.InputType.Message:
|
1921
|
-
return (0,
|
1921
|
+
return (0, import_utils9.hexlify)(input.recipient) === ownerAddress.toB256();
|
1922
1922
|
default:
|
1923
1923
|
return false;
|
1924
1924
|
}
|
@@ -2084,7 +2084,7 @@ var BaseTransactionRequest = class {
|
|
2084
2084
|
*/
|
2085
2085
|
addChangeOutput(to, assetId = import_configs6.BaseAssetId) {
|
2086
2086
|
const changeOutput = this.getChangeOutputs().find(
|
2087
|
-
(output) => (0,
|
2087
|
+
(output) => (0, import_utils9.hexlify)(output.assetId) === assetId
|
2088
2088
|
);
|
2089
2089
|
if (!changeOutput) {
|
2090
2090
|
this.pushOutput({
|
@@ -2140,7 +2140,7 @@ var BaseTransactionRequest = class {
|
|
2140
2140
|
*
|
2141
2141
|
* @param quantities - CoinQuantity Array.
|
2142
2142
|
*/
|
2143
|
-
fundWithFakeUtxos(quantities) {
|
2143
|
+
fundWithFakeUtxos(quantities, resourcesOwner) {
|
2144
2144
|
let idCounter = 0;
|
2145
2145
|
const generateId = () => {
|
2146
2146
|
const counterString = String(idCounter++);
|
@@ -2164,7 +2164,7 @@ var BaseTransactionRequest = class {
|
|
2164
2164
|
id: generateId(),
|
2165
2165
|
amount: quantity,
|
2166
2166
|
assetId,
|
2167
|
-
owner: import_address.Address.fromRandom(),
|
2167
|
+
owner: resourcesOwner || import_address.Address.fromRandom(),
|
2168
2168
|
maturity: 0,
|
2169
2169
|
blockCreated: (0, import_math6.bn)(1),
|
2170
2170
|
txCreatedIdx: (0, import_math6.bn)(1)
|
@@ -2197,19 +2197,29 @@ var BaseTransactionRequest = class {
|
|
2197
2197
|
toJSON() {
|
2198
2198
|
return normalizeJSON(this);
|
2199
2199
|
}
|
2200
|
-
|
2201
|
-
|
2202
|
-
|
2203
|
-
|
2204
|
-
|
2205
|
-
|
2206
|
-
|
2207
|
-
|
2208
|
-
|
2209
|
-
|
2210
|
-
|
2211
|
-
|
2212
|
-
|
2200
|
+
updatePredicateInputs(inputs) {
|
2201
|
+
this.inputs.forEach((i) => {
|
2202
|
+
let correspondingInput;
|
2203
|
+
switch (i.type) {
|
2204
|
+
case import_transactions5.InputType.Contract:
|
2205
|
+
return;
|
2206
|
+
case import_transactions5.InputType.Coin:
|
2207
|
+
correspondingInput = inputs.find((x) => x.type === import_transactions5.InputType.Coin && x.owner === i.owner);
|
2208
|
+
break;
|
2209
|
+
case import_transactions5.InputType.Message:
|
2210
|
+
correspondingInput = inputs.find(
|
2211
|
+
(x) => x.type === import_transactions5.InputType.Message && x.sender === i.sender
|
2212
|
+
);
|
2213
|
+
break;
|
2214
|
+
default:
|
2215
|
+
break;
|
2216
|
+
}
|
2217
|
+
if (correspondingInput && "predicateGasUsed" in correspondingInput && (0, import_math6.bn)(correspondingInput.predicateGasUsed).gt(0)) {
|
2218
|
+
i.predicate = correspondingInput.predicate;
|
2219
|
+
i.predicateData = correspondingInput.predicateData;
|
2220
|
+
i.predicateGasUsed = correspondingInput.predicateGasUsed;
|
2221
|
+
}
|
2222
|
+
});
|
2213
2223
|
}
|
2214
2224
|
};
|
2215
2225
|
|
@@ -2217,14 +2227,15 @@ var BaseTransactionRequest = class {
|
|
2217
2227
|
var import_configs8 = require("@fuel-ts/address/configs");
|
2218
2228
|
var import_math8 = require("@fuel-ts/math");
|
2219
2229
|
var import_transactions7 = require("@fuel-ts/transactions");
|
2220
|
-
var
|
2230
|
+
var import_utils13 = require("@fuel-ts/utils");
|
2221
2231
|
|
2222
2232
|
// src/providers/transaction-request/hash-transaction.ts
|
2223
2233
|
var import_configs7 = require("@fuel-ts/address/configs");
|
2224
2234
|
var import_hasher = require("@fuel-ts/hasher");
|
2225
2235
|
var import_math7 = require("@fuel-ts/math");
|
2226
2236
|
var import_transactions6 = require("@fuel-ts/transactions");
|
2227
|
-
var
|
2237
|
+
var import_utils11 = require("@fuel-ts/utils");
|
2238
|
+
var import_ethers = require("ethers");
|
2228
2239
|
var import_ramda2 = require("ramda");
|
2229
2240
|
function hashTransaction(transactionRequest, chainId) {
|
2230
2241
|
const transaction = transactionRequest.toTransaction();
|
@@ -2286,15 +2297,15 @@ function hashTransaction(transactionRequest, chainId) {
|
|
2286
2297
|
transaction.witnessesCount = 0;
|
2287
2298
|
transaction.witnesses = [];
|
2288
2299
|
const chainIdBytes = (0, import_hasher.uint64ToBytesBE)(chainId);
|
2289
|
-
const concatenatedData = (0,
|
2290
|
-
return (0,
|
2300
|
+
const concatenatedData = (0, import_utils11.concat)([chainIdBytes, new import_transactions6.TransactionCoder().encode(transaction)]);
|
2301
|
+
return (0, import_ethers.sha256)(concatenatedData);
|
2291
2302
|
}
|
2292
2303
|
|
2293
2304
|
// src/providers/transaction-request/storage-slot.ts
|
2294
|
-
var
|
2305
|
+
var import_utils12 = require("@fuel-ts/utils");
|
2295
2306
|
var getStorageValue = (value) => {
|
2296
2307
|
const v = new Uint8Array(32);
|
2297
|
-
v.set((0,
|
2308
|
+
v.set((0, import_utils12.arrayify)(value));
|
2298
2309
|
return v;
|
2299
2310
|
};
|
2300
2311
|
var storageSlotify = (storageSlot) => {
|
@@ -2308,8 +2319,8 @@ var storageSlotify = (storageSlot) => {
|
|
2308
2319
|
value = storageSlot.value;
|
2309
2320
|
}
|
2310
2321
|
return {
|
2311
|
-
key: (0,
|
2312
|
-
value: (0,
|
2322
|
+
key: (0, import_utils12.hexlify)(key),
|
2323
|
+
value: (0, import_utils12.hexlify)(getStorageValue(value))
|
2313
2324
|
};
|
2314
2325
|
};
|
2315
2326
|
|
@@ -2342,7 +2353,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
|
|
2342
2353
|
} = {}) {
|
2343
2354
|
super(rest);
|
2344
2355
|
this.bytecodeWitnessIndex = bytecodeWitnessIndex ?? 0;
|
2345
|
-
this.salt = (0,
|
2356
|
+
this.salt = (0, import_utils13.hexlify)(salt ?? import_configs8.ZeroBytes32);
|
2346
2357
|
this.storageSlots = [...storageSlots ?? []];
|
2347
2358
|
}
|
2348
2359
|
/**
|
@@ -2360,7 +2371,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
|
|
2360
2371
|
bytecodeLength: baseTransaction.witnesses[bytecodeWitnessIndex].dataLength / 4,
|
2361
2372
|
bytecodeWitnessIndex,
|
2362
2373
|
storageSlotsCount: storageSlots.length,
|
2363
|
-
salt: this.salt ? (0,
|
2374
|
+
salt: this.salt ? (0, import_utils13.hexlify)(this.salt) : import_configs8.ZeroBytes32,
|
2364
2375
|
storageSlots
|
2365
2376
|
};
|
2366
2377
|
}
|
@@ -2399,7 +2410,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
|
|
2399
2410
|
}
|
2400
2411
|
metadataGas(gasCosts) {
|
2401
2412
|
return calculateMetadataGasForTxCreate({
|
2402
|
-
contractBytesSize: (0, import_math8.bn)((0,
|
2413
|
+
contractBytesSize: (0, import_math8.bn)((0, import_utils13.arrayify)(this.witnesses[this.bytecodeWitnessIndex] || "0x").length),
|
2403
2414
|
gasCosts,
|
2404
2415
|
stateRootSize: this.storageSlots.length,
|
2405
2416
|
txBytesSize: this.byteSize()
|
@@ -2413,17 +2424,17 @@ var import_address2 = require("@fuel-ts/address");
|
|
2413
2424
|
var import_configs9 = require("@fuel-ts/address/configs");
|
2414
2425
|
var import_math9 = require("@fuel-ts/math");
|
2415
2426
|
var import_transactions8 = require("@fuel-ts/transactions");
|
2416
|
-
var
|
2427
|
+
var import_utils15 = require("@fuel-ts/utils");
|
2417
2428
|
|
2418
2429
|
// src/providers/transaction-request/scripts.ts
|
2419
|
-
var
|
2430
|
+
var import_utils14 = require("@fuel-ts/utils");
|
2420
2431
|
var returnZeroScript = {
|
2421
2432
|
/*
|
2422
2433
|
Opcode::RET(REG_ZERO)
|
2423
2434
|
Opcode::NOOP
|
2424
2435
|
*/
|
2425
2436
|
// TODO: Don't use hardcoded scripts: https://github.com/FuelLabs/fuels-ts/issues/281
|
2426
|
-
bytes: (0,
|
2437
|
+
bytes: (0, import_utils14.arrayify)("0x24000000"),
|
2427
2438
|
encodeScriptData: () => new Uint8Array(0)
|
2428
2439
|
};
|
2429
2440
|
var withdrawScript = {
|
@@ -2437,7 +2448,7 @@ var withdrawScript = {
|
|
2437
2448
|
00000000 00000000 [amount value]
|
2438
2449
|
*/
|
2439
2450
|
// TODO: Don't use hardcoded scripts: https://github.com/FuelLabs/fuels-ts/issues/281
|
2440
|
-
bytes: (0,
|
2451
|
+
bytes: (0, import_utils14.arrayify)("0x5040C0105D44C0064C40001124000000"),
|
2441
2452
|
encodeScriptData: () => new Uint8Array(0)
|
2442
2453
|
};
|
2443
2454
|
|
@@ -2465,8 +2476,8 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
2465
2476
|
constructor({ script, scriptData, gasLimit, ...rest } = {}) {
|
2466
2477
|
super(rest);
|
2467
2478
|
this.gasLimit = (0, import_math9.bn)(gasLimit);
|
2468
|
-
this.script = (0,
|
2469
|
-
this.scriptData = (0,
|
2479
|
+
this.script = (0, import_utils15.arrayify)(script ?? returnZeroScript.bytes);
|
2480
|
+
this.scriptData = (0, import_utils15.arrayify)(scriptData ?? returnZeroScript.encodeScriptData());
|
2470
2481
|
}
|
2471
2482
|
/**
|
2472
2483
|
* Converts the transaction request to a `TransactionScript`.
|
@@ -2474,8 +2485,8 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
2474
2485
|
* @returns The transaction script object.
|
2475
2486
|
*/
|
2476
2487
|
toTransaction() {
|
2477
|
-
const script = (0,
|
2478
|
-
const scriptData = (0,
|
2488
|
+
const script = (0, import_utils15.arrayify)(this.script ?? "0x");
|
2489
|
+
const scriptData = (0, import_utils15.arrayify)(this.scriptData ?? "0x");
|
2479
2490
|
return {
|
2480
2491
|
type: import_transactions8.TransactionType.Script,
|
2481
2492
|
scriptGasLimit: this.gasLimit,
|
@@ -2483,8 +2494,8 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
2483
2494
|
scriptLength: script.length,
|
2484
2495
|
scriptDataLength: scriptData.length,
|
2485
2496
|
receiptsRoot: import_configs9.ZeroBytes32,
|
2486
|
-
script: (0,
|
2487
|
-
scriptData: (0,
|
2497
|
+
script: (0, import_utils15.hexlify)(script),
|
2498
|
+
scriptData: (0, import_utils15.hexlify)(scriptData)
|
2488
2499
|
};
|
2489
2500
|
}
|
2490
2501
|
/**
|
@@ -2635,15 +2646,15 @@ var transactionRequestify = (obj) => {
|
|
2635
2646
|
var import_errors12 = require("@fuel-ts/errors");
|
2636
2647
|
var import_math13 = require("@fuel-ts/math");
|
2637
2648
|
var import_transactions15 = require("@fuel-ts/transactions");
|
2638
|
-
var
|
2649
|
+
var import_utils21 = require("@fuel-ts/utils");
|
2639
2650
|
|
2640
2651
|
// src/providers/transaction-summary/assemble-transaction-summary.ts
|
2641
|
-
var
|
2652
|
+
var import_utils19 = require("@fuel-ts/utils");
|
2642
2653
|
|
2643
2654
|
// src/providers/transaction-summary/calculate-transaction-fee.ts
|
2644
2655
|
var import_math10 = require("@fuel-ts/math");
|
2645
2656
|
var import_transactions10 = require("@fuel-ts/transactions");
|
2646
|
-
var
|
2657
|
+
var import_utils16 = require("@fuel-ts/utils");
|
2647
2658
|
var calculateTransactionFee = (params) => {
|
2648
2659
|
const {
|
2649
2660
|
gasUsed,
|
@@ -2652,7 +2663,7 @@ var calculateTransactionFee = (params) => {
|
|
2652
2663
|
} = params;
|
2653
2664
|
const gasPerByte = (0, import_math10.bn)(feeParams.gasPerByte);
|
2654
2665
|
const gasPriceFactor = (0, import_math10.bn)(feeParams.gasPriceFactor);
|
2655
|
-
const transactionBytes = (0,
|
2666
|
+
const transactionBytes = (0, import_utils16.arrayify)(rawPayload);
|
2656
2667
|
const [transaction] = new import_transactions10.TransactionCoder().decode(transactionBytes, 0);
|
2657
2668
|
if (transaction.type === import_transactions10.TransactionType.Mint) {
|
2658
2669
|
return {
|
@@ -2667,7 +2678,7 @@ var calculateTransactionFee = (params) => {
|
|
2667
2678
|
let gasLimit = (0, import_math10.bn)(0);
|
2668
2679
|
if (type === import_transactions10.TransactionType.Create) {
|
2669
2680
|
const { bytecodeWitnessIndex, storageSlots } = transaction;
|
2670
|
-
const contractBytesSize = (0, import_math10.bn)((0,
|
2681
|
+
const contractBytesSize = (0, import_math10.bn)((0, import_utils16.arrayify)(witnesses[bytecodeWitnessIndex].data).length);
|
2671
2682
|
metadataGas = calculateMetadataGasForTxCreate({
|
2672
2683
|
contractBytesSize,
|
2673
2684
|
gasCosts,
|
@@ -3355,7 +3366,7 @@ function assembleTransactionSummary(params) {
|
|
3355
3366
|
gasCosts
|
3356
3367
|
} = params;
|
3357
3368
|
const gasUsed = getGasUsedFromReceipts(receipts);
|
3358
|
-
const rawPayload = (0,
|
3369
|
+
const rawPayload = (0, import_utils19.hexlify)(transactionBytes);
|
3359
3370
|
const operations = getOperations({
|
3360
3371
|
transactionType: transaction.type,
|
3361
3372
|
inputs: transaction.inputs || [],
|
@@ -3472,7 +3483,7 @@ var TransactionResponse = class {
|
|
3472
3483
|
*/
|
3473
3484
|
decodeTransaction(transactionWithReceipts) {
|
3474
3485
|
return new import_transactions15.TransactionCoder().decode(
|
3475
|
-
(0,
|
3486
|
+
(0, import_utils21.arrayify)(transactionWithReceipts.rawPayload),
|
3476
3487
|
0
|
3477
3488
|
)?.[0];
|
3478
3489
|
}
|
@@ -3498,7 +3509,7 @@ var TransactionResponse = class {
|
|
3498
3509
|
id: this.id,
|
3499
3510
|
receipts,
|
3500
3511
|
transaction: decodedTransaction,
|
3501
|
-
transactionBytes: (0,
|
3512
|
+
transactionBytes: (0, import_utils21.arrayify)(transaction.rawPayload),
|
3502
3513
|
gqlTransactionStatus: transaction.status,
|
3503
3514
|
gasPerByte,
|
3504
3515
|
gasPriceFactor,
|
@@ -3833,7 +3844,7 @@ var _Provider = class {
|
|
3833
3844
|
name,
|
3834
3845
|
consensusParameters: { chainId }
|
3835
3846
|
} = await this.getChain();
|
3836
|
-
const network = new
|
3847
|
+
const network = new import_ethers2.Network(name, chainId.toNumber());
|
3837
3848
|
return Promise.resolve(network);
|
3838
3849
|
}
|
3839
3850
|
/**
|
@@ -3901,7 +3912,7 @@ var _Provider = class {
|
|
3901
3912
|
if (estimateTxDependencies) {
|
3902
3913
|
await this.estimateTxDependencies(transactionRequest);
|
3903
3914
|
}
|
3904
|
-
const encodedTransaction = (0,
|
3915
|
+
const encodedTransaction = (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes());
|
3905
3916
|
if (awaitExecution) {
|
3906
3917
|
const subscription = this.operations.submitAndAwait({ encodedTransaction });
|
3907
3918
|
for await (const { submitAndAwait } of subscription) {
|
@@ -3932,9 +3943,9 @@ var _Provider = class {
|
|
3932
3943
|
async call(transactionRequestLike, { utxoValidation, estimateTxDependencies = true } = {}) {
|
3933
3944
|
const transactionRequest = transactionRequestify(transactionRequestLike);
|
3934
3945
|
if (estimateTxDependencies) {
|
3935
|
-
|
3946
|
+
return this.estimateTxDependencies(transactionRequest);
|
3936
3947
|
}
|
3937
|
-
const encodedTransaction = (0,
|
3948
|
+
const encodedTransaction = (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes());
|
3938
3949
|
const { dryRun: gqlReceipts } = await this.operations.dryRun({
|
3939
3950
|
encodedTransaction,
|
3940
3951
|
utxoValidation: utxoValidation || false
|
@@ -3951,7 +3962,15 @@ var _Provider = class {
|
|
3951
3962
|
* @returns A promise that resolves to the estimated transaction request object.
|
3952
3963
|
*/
|
3953
3964
|
async estimatePredicates(transactionRequest) {
|
3954
|
-
const
|
3965
|
+
const shouldEstimatePredicates = Boolean(
|
3966
|
+
transactionRequest.inputs.find(
|
3967
|
+
(input) => "predicate" in input && input.predicate && !(0, import_utils23.equalBytes)((0, import_utils22.arrayify)(input.predicate), (0, import_utils22.arrayify)("0x")) && new import_math14.BN(input.predicateGasUsed).isZero()
|
3968
|
+
)
|
3969
|
+
);
|
3970
|
+
if (!shouldEstimatePredicates) {
|
3971
|
+
return transactionRequest;
|
3972
|
+
}
|
3973
|
+
const encodedTransaction = (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes());
|
3955
3974
|
const response = await this.operations.estimatePredicates({
|
3956
3975
|
encodedTransaction
|
3957
3976
|
});
|
@@ -3981,34 +4000,33 @@ var _Provider = class {
|
|
3981
4000
|
* @returns A promise.
|
3982
4001
|
*/
|
3983
4002
|
async estimateTxDependencies(transactionRequest) {
|
3984
|
-
let missingOutputVariableCount = 0;
|
3985
|
-
let missingOutputContractIdsCount = 0;
|
3986
|
-
let tries = 0;
|
3987
4003
|
if (transactionRequest.type === import_transactions17.TransactionType.Create) {
|
3988
|
-
return
|
3989
|
-
|
3990
|
-
|
3991
|
-
if (txRequest.hasPredicateInput()) {
|
3992
|
-
txRequest = await this.estimatePredicates(txRequest);
|
4004
|
+
return {
|
4005
|
+
receipts: []
|
4006
|
+
};
|
3993
4007
|
}
|
3994
|
-
|
4008
|
+
await this.estimatePredicates(transactionRequest);
|
4009
|
+
let receipts = [];
|
4010
|
+
for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
|
3995
4011
|
const { dryRun: gqlReceipts } = await this.operations.dryRun({
|
3996
|
-
encodedTransaction: (0,
|
4012
|
+
encodedTransaction: (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes()),
|
3997
4013
|
utxoValidation: false
|
3998
4014
|
});
|
3999
|
-
|
4015
|
+
receipts = gqlReceipts.map(processGqlReceipt);
|
4000
4016
|
const { missingOutputVariables, missingOutputContractIds } = getReceiptsWithMissingData(receipts);
|
4001
|
-
|
4002
|
-
|
4003
|
-
|
4004
|
-
|
4017
|
+
const hasMissingOutputs = missingOutputVariables.length !== 0 || missingOutputContractIds.length !== 0;
|
4018
|
+
if (hasMissingOutputs) {
|
4019
|
+
transactionRequest.addVariableOutputs(missingOutputVariables.length);
|
4020
|
+
missingOutputContractIds.forEach(({ contractId }) => {
|
4021
|
+
transactionRequest.addContractInputAndOutput(import_address3.Address.fromString(contractId));
|
4022
|
+
});
|
4023
|
+
} else {
|
4024
|
+
break;
|
4005
4025
|
}
|
4006
|
-
txRequest.addVariableOutputs(missingOutputVariableCount);
|
4007
|
-
missingOutputContractIds.forEach(
|
4008
|
-
({ contractId }) => txRequest.addContractInputAndOutput(import_address3.Address.fromString(contractId))
|
4009
|
-
);
|
4010
|
-
tries += 1;
|
4011
4026
|
}
|
4027
|
+
return {
|
4028
|
+
receipts
|
4029
|
+
};
|
4012
4030
|
}
|
4013
4031
|
/**
|
4014
4032
|
* Executes a signed transaction without applying the states changes
|
@@ -4023,9 +4041,9 @@ var _Provider = class {
|
|
4023
4041
|
async simulate(transactionRequestLike, { estimateTxDependencies = true } = {}) {
|
4024
4042
|
const transactionRequest = transactionRequestify(transactionRequestLike);
|
4025
4043
|
if (estimateTxDependencies) {
|
4026
|
-
|
4044
|
+
return this.estimateTxDependencies(transactionRequest);
|
4027
4045
|
}
|
4028
|
-
const encodedTransaction = (0,
|
4046
|
+
const encodedTransaction = (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes());
|
4029
4047
|
const { dryRun: gqlReceipts } = await this.operations.dryRun({
|
4030
4048
|
encodedTransaction,
|
4031
4049
|
utxoValidation: true
|
@@ -4050,36 +4068,38 @@ var _Provider = class {
|
|
4050
4068
|
* @param tolerance - The tolerance to add on top of the gasUsed.
|
4051
4069
|
* @returns A promise that resolves to the transaction cost object.
|
4052
4070
|
*/
|
4053
|
-
async getTransactionCost(transactionRequestLike, forwardingQuantities = [], {
|
4054
|
-
|
4071
|
+
async getTransactionCost(transactionRequestLike, forwardingQuantities = [], {
|
4072
|
+
estimateTxDependencies = true,
|
4073
|
+
estimatePredicates = true,
|
4074
|
+
resourcesOwner
|
4075
|
+
} = {}) {
|
4076
|
+
const txRequestClone = (0, import_ramda3.clone)(transactionRequestify(transactionRequestLike));
|
4055
4077
|
const chainInfo = this.getChain();
|
4056
4078
|
const { gasPriceFactor, minGasPrice, maxGasPerTx } = this.getGasConfig();
|
4057
|
-
const gasPrice = (0, import_math14.max)(
|
4058
|
-
const isScriptTransaction =
|
4059
|
-
|
4079
|
+
const gasPrice = (0, import_math14.max)(txRequestClone.gasPrice, minGasPrice);
|
4080
|
+
const isScriptTransaction = txRequestClone.type === import_transactions17.TransactionType.Script;
|
4081
|
+
const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
|
4082
|
+
const allQuantities = mergeQuantities(coinOutputsQuantities, forwardingQuantities);
|
4083
|
+
txRequestClone.fundWithFakeUtxos(allQuantities, resourcesOwner?.address);
|
4084
|
+
if (estimatePredicates) {
|
4060
4085
|
if (isScriptTransaction) {
|
4061
|
-
|
4086
|
+
txRequestClone.gasLimit = (0, import_math14.bn)(0);
|
4062
4087
|
}
|
4063
|
-
|
4088
|
+
if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
|
4089
|
+
resourcesOwner.populateTransactionPredicateData(txRequestClone);
|
4090
|
+
}
|
4091
|
+
await this.estimatePredicates(txRequestClone);
|
4064
4092
|
}
|
4065
|
-
const minGas =
|
4066
|
-
const maxGas =
|
4067
|
-
const coinOutputsQuantities = transactionRequest.getCoinOutputsQuantities();
|
4068
|
-
const allQuantities = mergeQuantities(coinOutputsQuantities, forwardingQuantities);
|
4069
|
-
transactionRequest.fundWithFakeUtxos(allQuantities);
|
4070
|
-
let gasUsed = minGas;
|
4093
|
+
const minGas = txRequestClone.calculateMinGas(chainInfo);
|
4094
|
+
const maxGas = txRequestClone.calculateMaxGas(chainInfo, minGas);
|
4071
4095
|
let receipts = [];
|
4072
|
-
if (isScriptTransaction) {
|
4073
|
-
|
4074
|
-
|
4075
|
-
const result = await this.
|
4076
|
-
estimateTxDependencies
|
4077
|
-
});
|
4096
|
+
if (isScriptTransaction && estimateTxDependencies) {
|
4097
|
+
txRequestClone.gasPrice = (0, import_math14.bn)(0);
|
4098
|
+
txRequestClone.gasLimit = (0, import_math14.bn)(maxGasPerTx.sub(maxGas).toNumber() * 0.9);
|
4099
|
+
const result = await this.estimateTxDependencies(txRequestClone);
|
4078
4100
|
receipts = result.receipts;
|
4079
|
-
gasUsed = getGasUsedFromReceipts(receipts);
|
4080
|
-
} else {
|
4081
|
-
gasUsed = minGas;
|
4082
4101
|
}
|
4102
|
+
const gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : minGas;
|
4083
4103
|
const usedFee = calculatePriceWithFactor(
|
4084
4104
|
gasUsed,
|
4085
4105
|
gasPrice,
|
@@ -4097,7 +4117,9 @@ var _Provider = class {
|
|
4097
4117
|
maxGas,
|
4098
4118
|
usedFee,
|
4099
4119
|
minFee,
|
4100
|
-
maxFee
|
4120
|
+
maxFee,
|
4121
|
+
estimatedInputs: txRequestClone.inputs,
|
4122
|
+
estimatedOutputs: txRequestClone.outputs
|
4101
4123
|
};
|
4102
4124
|
}
|
4103
4125
|
async getResourcesForTransaction(owner, transactionRequestLike, forwardingQuantities = []) {
|
@@ -4126,7 +4148,7 @@ var _Provider = class {
|
|
4126
4148
|
const result = await this.operations.getCoins({
|
4127
4149
|
first: 10,
|
4128
4150
|
...paginationArgs,
|
4129
|
-
filter: { owner: ownerAddress.toB256(), assetId: assetId && (0,
|
4151
|
+
filter: { owner: ownerAddress.toB256(), assetId: assetId && (0, import_utils22.hexlify)(assetId) }
|
4130
4152
|
});
|
4131
4153
|
const coins = result.coins.edges.map((edge) => edge.node);
|
4132
4154
|
return coins.map((coin) => ({
|
@@ -4150,19 +4172,19 @@ var _Provider = class {
|
|
4150
4172
|
async getResourcesToSpend(owner, quantities, excludedIds) {
|
4151
4173
|
const ownerAddress = import_address3.Address.fromAddressOrString(owner);
|
4152
4174
|
const excludeInput = {
|
4153
|
-
messages: excludedIds?.messages?.map((nonce) => (0,
|
4154
|
-
utxos: excludedIds?.utxos?.map((id) => (0,
|
4175
|
+
messages: excludedIds?.messages?.map((nonce) => (0, import_utils22.hexlify)(nonce)) || [],
|
4176
|
+
utxos: excludedIds?.utxos?.map((id) => (0, import_utils22.hexlify)(id)) || []
|
4155
4177
|
};
|
4156
4178
|
if (this.cache) {
|
4157
4179
|
const uniqueUtxos = new Set(
|
4158
|
-
excludeInput.utxos.concat(this.cache?.getActiveData().map((id) => (0,
|
4180
|
+
excludeInput.utxos.concat(this.cache?.getActiveData().map((id) => (0, import_utils22.hexlify)(id)))
|
4159
4181
|
);
|
4160
4182
|
excludeInput.utxos = Array.from(uniqueUtxos);
|
4161
4183
|
}
|
4162
4184
|
const coinsQuery = {
|
4163
4185
|
owner: ownerAddress.toB256(),
|
4164
4186
|
queryPerAsset: quantities.map(coinQuantityfy).map(({ assetId, amount, max: maxPerAsset }) => ({
|
4165
|
-
assetId: (0,
|
4187
|
+
assetId: (0, import_utils22.hexlify)(assetId),
|
4166
4188
|
amount: amount.toString(10),
|
4167
4189
|
max: maxPerAsset ? maxPerAsset.toString(10) : void 0
|
4168
4190
|
})),
|
@@ -4265,7 +4287,7 @@ var _Provider = class {
|
|
4265
4287
|
time: block.header.time,
|
4266
4288
|
transactionIds: block.transactions.map((tx) => tx.id),
|
4267
4289
|
transactions: block.transactions.map(
|
4268
|
-
(tx) => new import_transactions17.TransactionCoder().decode((0,
|
4290
|
+
(tx) => new import_transactions17.TransactionCoder().decode((0, import_utils22.arrayify)(tx.rawPayload), 0)?.[0]
|
4269
4291
|
)
|
4270
4292
|
};
|
4271
4293
|
}
|
@@ -4281,7 +4303,7 @@ var _Provider = class {
|
|
4281
4303
|
return null;
|
4282
4304
|
}
|
4283
4305
|
return new import_transactions17.TransactionCoder().decode(
|
4284
|
-
(0,
|
4306
|
+
(0, import_utils22.arrayify)(transaction.rawPayload),
|
4285
4307
|
0
|
4286
4308
|
)?.[0];
|
4287
4309
|
}
|
@@ -4308,7 +4330,7 @@ var _Provider = class {
|
|
4308
4330
|
async getContractBalance(contractId, assetId) {
|
4309
4331
|
const { contractBalance } = await this.operations.getContractBalance({
|
4310
4332
|
contract: import_address3.Address.fromAddressOrString(contractId).toB256(),
|
4311
|
-
asset: (0,
|
4333
|
+
asset: (0, import_utils22.hexlify)(assetId)
|
4312
4334
|
});
|
4313
4335
|
return (0, import_math14.bn)(contractBalance.amount, 10);
|
4314
4336
|
}
|
@@ -4322,7 +4344,7 @@ var _Provider = class {
|
|
4322
4344
|
async getBalance(owner, assetId) {
|
4323
4345
|
const { balance } = await this.operations.getBalance({
|
4324
4346
|
owner: import_address3.Address.fromAddressOrString(owner).toB256(),
|
4325
|
-
assetId: (0,
|
4347
|
+
assetId: (0, import_utils22.hexlify)(assetId)
|
4326
4348
|
});
|
4327
4349
|
return (0, import_math14.bn)(balance.amount, 10);
|
4328
4350
|
}
|
@@ -4487,6 +4509,10 @@ var _Provider = class {
|
|
4487
4509
|
});
|
4488
4510
|
return (0, import_math14.bn)(latestBlockHeight);
|
4489
4511
|
}
|
4512
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
4513
|
+
async getTransactionResponse(transactionId) {
|
4514
|
+
return new TransactionResponse(transactionId, this);
|
4515
|
+
}
|
4490
4516
|
};
|
4491
4517
|
var Provider = _Provider;
|
4492
4518
|
_cacheInputs = new WeakSet();
|
@@ -4507,7 +4533,7 @@ __publicField(Provider, "nodeInfoCache", {});
|
|
4507
4533
|
var import_errors14 = require("@fuel-ts/errors");
|
4508
4534
|
var import_math15 = require("@fuel-ts/math");
|
4509
4535
|
var import_transactions18 = require("@fuel-ts/transactions");
|
4510
|
-
var
|
4536
|
+
var import_utils25 = require("@fuel-ts/utils");
|
4511
4537
|
async function getTransactionSummary(params) {
|
4512
4538
|
const { id, provider, abiMap } = params;
|
4513
4539
|
const { transaction: gqlTransaction } = await provider.operations.getTransactionWithReceipts({
|
@@ -4520,7 +4546,7 @@ async function getTransactionSummary(params) {
|
|
4520
4546
|
);
|
4521
4547
|
}
|
4522
4548
|
const [decodedTransaction] = new import_transactions18.TransactionCoder().decode(
|
4523
|
-
(0,
|
4549
|
+
(0, import_utils25.arrayify)(gqlTransaction.rawPayload),
|
4524
4550
|
0
|
4525
4551
|
);
|
4526
4552
|
const receipts = gqlTransaction.receipts?.map(processGqlReceipt) || [];
|
@@ -4531,7 +4557,7 @@ async function getTransactionSummary(params) {
|
|
4531
4557
|
id: gqlTransaction.id,
|
4532
4558
|
receipts,
|
4533
4559
|
transaction: decodedTransaction,
|
4534
|
-
transactionBytes: (0,
|
4560
|
+
transactionBytes: (0, import_utils25.arrayify)(gqlTransaction.rawPayload),
|
4535
4561
|
gqlTransactionStatus: gqlTransaction.status,
|
4536
4562
|
gasPerByte: (0, import_math15.bn)(gasPerByte),
|
4537
4563
|
gasPriceFactor: (0, import_math15.bn)(gasPriceFactor),
|
@@ -4573,13 +4599,13 @@ async function getTransactionsSummaries(params) {
|
|
4573
4599
|
const transactions = edges.map((edge) => {
|
4574
4600
|
const { node: gqlTransaction } = edge;
|
4575
4601
|
const { id, rawPayload, receipts: gqlReceipts, status } = gqlTransaction;
|
4576
|
-
const [decodedTransaction] = new import_transactions18.TransactionCoder().decode((0,
|
4602
|
+
const [decodedTransaction] = new import_transactions18.TransactionCoder().decode((0, import_utils25.arrayify)(rawPayload), 0);
|
4577
4603
|
const receipts = gqlReceipts?.map(processGqlReceipt) || [];
|
4578
4604
|
const transactionSummary = assembleTransactionSummary({
|
4579
4605
|
id,
|
4580
4606
|
receipts,
|
4581
4607
|
transaction: decodedTransaction,
|
4582
|
-
transactionBytes: (0,
|
4608
|
+
transactionBytes: (0, import_utils25.arrayify)(rawPayload),
|
4583
4609
|
gqlTransactionStatus: status,
|
4584
4610
|
abiMap,
|
4585
4611
|
gasPerByte,
|
@@ -4599,19 +4625,140 @@ async function getTransactionsSummaries(params) {
|
|
4599
4625
|
};
|
4600
4626
|
}
|
4601
4627
|
|
4628
|
+
// src/providers/chains.ts
|
4629
|
+
var CHAIN_IDS = {
|
4630
|
+
eth: {
|
4631
|
+
sepolia: 11155111,
|
4632
|
+
foundry: 31337
|
4633
|
+
},
|
4634
|
+
fuel: {
|
4635
|
+
beta5: 0,
|
4636
|
+
devnet: 10
|
4637
|
+
}
|
4638
|
+
};
|
4639
|
+
|
4640
|
+
// src/providers/assets/utils/network.ts
|
4641
|
+
var getDefaultChainId = (networkType) => {
|
4642
|
+
if (networkType === "ethereum") {
|
4643
|
+
return CHAIN_IDS.eth.sepolia;
|
4644
|
+
}
|
4645
|
+
if (networkType === "fuel") {
|
4646
|
+
return CHAIN_IDS.fuel.beta5;
|
4647
|
+
}
|
4648
|
+
return void 0;
|
4649
|
+
};
|
4650
|
+
var getAssetNetwork = ({
|
4651
|
+
asset,
|
4652
|
+
chainId,
|
4653
|
+
networkType
|
4654
|
+
}) => {
|
4655
|
+
const network = asset.networks.find(
|
4656
|
+
(item) => item.chainId === chainId && item.type === networkType
|
4657
|
+
);
|
4658
|
+
return network;
|
4659
|
+
};
|
4660
|
+
var getAssetWithNetwork = ({
|
4661
|
+
asset,
|
4662
|
+
chainId,
|
4663
|
+
networkType
|
4664
|
+
}) => {
|
4665
|
+
const { networks: _, ...assetRest } = asset;
|
4666
|
+
const chainIdToUse = chainId ?? getDefaultChainId(networkType);
|
4667
|
+
if (chainIdToUse === void 0) {
|
4668
|
+
return void 0;
|
4669
|
+
}
|
4670
|
+
const assetNetwork = getAssetNetwork({
|
4671
|
+
asset,
|
4672
|
+
chainId: chainIdToUse,
|
4673
|
+
networkType
|
4674
|
+
});
|
4675
|
+
if (!assetNetwork) {
|
4676
|
+
return void 0;
|
4677
|
+
}
|
4678
|
+
return {
|
4679
|
+
...assetRest,
|
4680
|
+
...assetNetwork
|
4681
|
+
};
|
4682
|
+
};
|
4683
|
+
var getAssetEth = (asset, chainId) => getAssetWithNetwork({
|
4684
|
+
asset,
|
4685
|
+
networkType: "ethereum",
|
4686
|
+
chainId
|
4687
|
+
});
|
4688
|
+
var getAssetFuel = (asset, chainId) => getAssetWithNetwork({
|
4689
|
+
asset,
|
4690
|
+
networkType: "fuel",
|
4691
|
+
chainId
|
4692
|
+
});
|
4693
|
+
|
4694
|
+
// src/providers/assets/utils/url.ts
|
4695
|
+
var DELIMITER_PATH = "/";
|
4696
|
+
var trimRegex = /^\/|\/$/g;
|
4697
|
+
var trimPath = (path = "") => path.replace(trimRegex, "");
|
4698
|
+
function urlJoin(baseUrl, ...paths) {
|
4699
|
+
const hasBaseUrl = baseUrl !== null && baseUrl !== void 0;
|
4700
|
+
const rootPath = baseUrl?.[0] === "/" && baseUrl.length > 1;
|
4701
|
+
const allPaths = [baseUrl, ...paths].filter(Boolean).map(trimPath);
|
4702
|
+
if (rootPath && hasBaseUrl) {
|
4703
|
+
allPaths.unshift("");
|
4704
|
+
}
|
4705
|
+
return allPaths.join(DELIMITER_PATH);
|
4706
|
+
}
|
4707
|
+
|
4708
|
+
// src/providers/assets/utils/resolveIconPaths.ts
|
4709
|
+
function resolveIconPaths(assets2, basePath = "./") {
|
4710
|
+
return assets2.map((asset) => ({
|
4711
|
+
...asset,
|
4712
|
+
icon: urlJoin(basePath, asset.icon)
|
4713
|
+
}));
|
4714
|
+
}
|
4715
|
+
|
4716
|
+
// src/providers/assets/index.ts
|
4717
|
+
var assets = [
|
4718
|
+
{
|
4719
|
+
name: "Ethereum",
|
4720
|
+
symbol: "ETH",
|
4721
|
+
icon: "eth.svg",
|
4722
|
+
networks: [
|
4723
|
+
{
|
4724
|
+
type: "ethereum",
|
4725
|
+
chainId: CHAIN_IDS.eth.sepolia,
|
4726
|
+
decimals: 18
|
4727
|
+
},
|
4728
|
+
{
|
4729
|
+
type: "ethereum",
|
4730
|
+
chainId: CHAIN_IDS.eth.foundry,
|
4731
|
+
decimals: 18
|
4732
|
+
},
|
4733
|
+
{
|
4734
|
+
type: "fuel",
|
4735
|
+
chainId: CHAIN_IDS.fuel.beta5,
|
4736
|
+
decimals: 9,
|
4737
|
+
assetId: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
4738
|
+
},
|
4739
|
+
{
|
4740
|
+
type: "fuel",
|
4741
|
+
chainId: CHAIN_IDS.fuel.devnet,
|
4742
|
+
decimals: 9,
|
4743
|
+
assetId: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
4744
|
+
}
|
4745
|
+
]
|
4746
|
+
}
|
4747
|
+
];
|
4748
|
+
|
4602
4749
|
// src/utils/formatTransferToContractScriptData.ts
|
4603
4750
|
var import_abi_coder4 = require("@fuel-ts/abi-coder");
|
4604
4751
|
var import_math16 = require("@fuel-ts/math");
|
4752
|
+
var import_utils26 = require("@fuel-ts/utils");
|
4605
4753
|
var asm = __toESM(require("@fuels/vm-asm"));
|
4606
|
-
var import_ethers20 = require("ethers");
|
4607
4754
|
var formatTransferToContractScriptData = (params) => {
|
4608
4755
|
const { assetId, amountToTransfer, hexlifiedContractId } = params;
|
4609
4756
|
const numberCoder = new import_abi_coder4.U64Coder();
|
4610
4757
|
const encoded = numberCoder.encode(new import_math16.BN(amountToTransfer).toNumber());
|
4611
4758
|
const scriptData = Uint8Array.from([
|
4612
|
-
...(0,
|
4759
|
+
...(0, import_utils26.arrayify)(hexlifiedContractId),
|
4613
4760
|
...encoded,
|
4614
|
-
...(0,
|
4761
|
+
...(0, import_utils26.arrayify)(assetId)
|
4615
4762
|
]);
|
4616
4763
|
return scriptData;
|
4617
4764
|
};
|
@@ -4645,15 +4792,17 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
4645
4792
|
* The provider used to interact with the network.
|
4646
4793
|
*/
|
4647
4794
|
_provider;
|
4795
|
+
_connector;
|
4648
4796
|
/**
|
4649
4797
|
* Creates a new Account instance.
|
4650
4798
|
*
|
4651
4799
|
* @param address - The address of the account.
|
4652
4800
|
* @param provider - A Provider instance (optional).
|
4653
4801
|
*/
|
4654
|
-
constructor(address, provider) {
|
4802
|
+
constructor(address, provider, connector) {
|
4655
4803
|
super();
|
4656
4804
|
this._provider = provider;
|
4805
|
+
this._connector = connector;
|
4657
4806
|
this.address = import_address4.Address.fromDynamicInput(address);
|
4658
4807
|
}
|
4659
4808
|
/**
|
@@ -4859,7 +5008,10 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
4859
5008
|
const params = { gasPrice: minGasPrice, ...txParams };
|
4860
5009
|
const request = new ScriptTransactionRequest(params);
|
4861
5010
|
request.addCoinOutput(import_address4.Address.fromAddressOrString(destination), amount, assetId);
|
4862
|
-
const { maxFee, requiredQuantities, gasUsed } = await this.provider.getTransactionCost(request
|
5011
|
+
const { maxFee, requiredQuantities, gasUsed, estimatedInputs } = await this.provider.getTransactionCost(request, [], {
|
5012
|
+
estimateTxDependencies: true,
|
5013
|
+
resourcesOwner: this
|
5014
|
+
});
|
4863
5015
|
request.gasPrice = (0, import_math17.bn)(txParams.gasPrice ?? minGasPrice);
|
4864
5016
|
request.gasLimit = (0, import_math17.bn)(txParams.gasLimit ?? gasUsed);
|
4865
5017
|
this.validateGas({
|
@@ -4869,6 +5021,7 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
4869
5021
|
minGasPrice
|
4870
5022
|
});
|
4871
5023
|
await this.fund(request, requiredQuantities, maxFee);
|
5024
|
+
request.updatePredicateInputs(estimatedInputs);
|
4872
5025
|
return request;
|
4873
5026
|
}
|
4874
5027
|
/**
|
@@ -4882,7 +5035,7 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
4882
5035
|
*/
|
4883
5036
|
async transfer(destination, amount, assetId = import_configs10.BaseAssetId, txParams = {}) {
|
4884
5037
|
const request = await this.createTransfer(destination, amount, assetId, txParams);
|
4885
|
-
return this.sendTransaction(request);
|
5038
|
+
return this.sendTransaction(request, { estimateTxDependencies: false });
|
4886
5039
|
}
|
4887
5040
|
/**
|
4888
5041
|
* Transfers coins to a contract address.
|
@@ -4933,14 +5086,14 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
4933
5086
|
async withdrawToBaseLayer(recipient, amount, txParams = {}) {
|
4934
5087
|
const { minGasPrice } = this.provider.getGasConfig();
|
4935
5088
|
const recipientAddress = import_address4.Address.fromAddressOrString(recipient);
|
4936
|
-
const recipientDataArray = (0,
|
5089
|
+
const recipientDataArray = (0, import_utils27.arrayify)(
|
4937
5090
|
"0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
|
4938
5091
|
);
|
4939
|
-
const amountDataArray = (0,
|
5092
|
+
const amountDataArray = (0, import_utils27.arrayify)(
|
4940
5093
|
"0x".concat((0, import_math17.bn)(amount).toHex().substring(2).padStart(16, "0"))
|
4941
5094
|
);
|
4942
5095
|
const script = new Uint8Array([
|
4943
|
-
...(0,
|
5096
|
+
...(0, import_utils27.arrayify)(withdrawScript.bytes),
|
4944
5097
|
...recipientDataArray,
|
4945
5098
|
...amountDataArray
|
4946
5099
|
]);
|
@@ -4961,17 +5114,30 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
4961
5114
|
await this.fund(request, requiredQuantities, maxFee);
|
4962
5115
|
return this.sendTransaction(request);
|
4963
5116
|
}
|
5117
|
+
async signMessage(message) {
|
5118
|
+
if (!this._connector) {
|
5119
|
+
throw new import_errors15.FuelError(import_errors15.ErrorCode.MISSING_CONNECTOR, "A connector is required to sign messages.");
|
5120
|
+
}
|
5121
|
+
return this._connector.signMessage(this.address.toString(), message);
|
5122
|
+
}
|
4964
5123
|
/**
|
4965
5124
|
* Sends a transaction to the network.
|
4966
5125
|
*
|
4967
5126
|
* @param transactionRequestLike - The transaction request to be sent.
|
4968
5127
|
* @returns A promise that resolves to the transaction response.
|
4969
5128
|
*/
|
4970
|
-
async sendTransaction(transactionRequestLike,
|
5129
|
+
async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, awaitExecution } = {}) {
|
5130
|
+
if (this._connector) {
|
5131
|
+
return this.provider.getTransactionResponse(
|
5132
|
+
await this._connector.sendTransaction(this.address.toString(), transactionRequestLike)
|
5133
|
+
);
|
5134
|
+
}
|
4971
5135
|
const transactionRequest = transactionRequestify(transactionRequestLike);
|
4972
|
-
|
5136
|
+
if (estimateTxDependencies) {
|
5137
|
+
await this.provider.estimateTxDependencies(transactionRequest);
|
5138
|
+
}
|
4973
5139
|
return this.provider.sendTransaction(transactionRequest, {
|
4974
|
-
|
5140
|
+
awaitExecution,
|
4975
5141
|
estimateTxDependencies: false
|
4976
5142
|
});
|
4977
5143
|
}
|
@@ -4981,9 +5147,11 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
4981
5147
|
* @param transactionRequestLike - The transaction request to be simulated.
|
4982
5148
|
* @returns A promise that resolves to the call result.
|
4983
5149
|
*/
|
4984
|
-
async simulateTransaction(transactionRequestLike) {
|
5150
|
+
async simulateTransaction(transactionRequestLike, { estimateTxDependencies = true } = {}) {
|
4985
5151
|
const transactionRequest = transactionRequestify(transactionRequestLike);
|
4986
|
-
|
5152
|
+
if (estimateTxDependencies) {
|
5153
|
+
await this.provider.estimateTxDependencies(transactionRequest);
|
5154
|
+
}
|
4987
5155
|
return this.provider.simulate(transactionRequest, { estimateTxDependencies: false });
|
4988
5156
|
}
|
4989
5157
|
validateGas({
|
@@ -5009,14 +5177,15 @@ var Account = class extends import_interfaces.AbstractAccount {
|
|
5009
5177
|
|
5010
5178
|
// src/wallet/base-wallet-unlocked.ts
|
5011
5179
|
var import_hasher3 = require("@fuel-ts/hasher");
|
5180
|
+
var import_utils30 = require("@fuel-ts/utils");
|
5012
5181
|
|
5013
5182
|
// src/signer/signer.ts
|
5014
5183
|
var import_address5 = require("@fuel-ts/address");
|
5015
5184
|
var import_crypto = require("@fuel-ts/crypto");
|
5016
5185
|
var import_hasher2 = require("@fuel-ts/hasher");
|
5017
5186
|
var import_math18 = require("@fuel-ts/math");
|
5187
|
+
var import_utils28 = require("@fuel-ts/utils");
|
5018
5188
|
var import_secp256k1 = require("@noble/curves/secp256k1");
|
5019
|
-
var import_ethers22 = require("ethers");
|
5020
5189
|
var Signer = class {
|
5021
5190
|
address;
|
5022
5191
|
publicKey;
|
@@ -5035,9 +5204,9 @@ var Signer = class {
|
|
5035
5204
|
}
|
5036
5205
|
}
|
5037
5206
|
const privateKeyBytes = (0, import_math18.toBytes)(privateKey, 32);
|
5038
|
-
this.privateKey = (0,
|
5039
|
-
this.publicKey = (0,
|
5040
|
-
this.compressedPublicKey = (0,
|
5207
|
+
this.privateKey = (0, import_utils28.hexlify)(privateKeyBytes);
|
5208
|
+
this.publicKey = (0, import_utils28.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, false).slice(1));
|
5209
|
+
this.compressedPublicKey = (0, import_utils28.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, true));
|
5041
5210
|
this.address = import_address5.Address.fromPublicKey(this.publicKey);
|
5042
5211
|
}
|
5043
5212
|
/**
|
@@ -5051,11 +5220,11 @@ var Signer = class {
|
|
5051
5220
|
* @returns hashed signature
|
5052
5221
|
*/
|
5053
5222
|
sign(data) {
|
5054
|
-
const signature = import_secp256k1.secp256k1.sign((0,
|
5223
|
+
const signature = import_secp256k1.secp256k1.sign((0, import_utils28.arrayify)(data), (0, import_utils28.arrayify)(this.privateKey));
|
5055
5224
|
const r = (0, import_math18.toBytes)(`0x${signature.r.toString(16)}`, 32);
|
5056
5225
|
const s = (0, import_math18.toBytes)(`0x${signature.s.toString(16)}`, 32);
|
5057
5226
|
s[0] |= (signature.recovery || 0) << 7;
|
5058
|
-
return (0,
|
5227
|
+
return (0, import_utils28.hexlify)((0, import_utils28.concat)([r, s]));
|
5059
5228
|
}
|
5060
5229
|
/**
|
5061
5230
|
* Add point on the current elliptic curve
|
@@ -5064,8 +5233,8 @@ var Signer = class {
|
|
5064
5233
|
* @returns compressed point on the curve
|
5065
5234
|
*/
|
5066
5235
|
addPoint(point) {
|
5067
|
-
const p0 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0,
|
5068
|
-
const p1 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0,
|
5236
|
+
const p0 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils28.arrayify)(this.compressedPublicKey));
|
5237
|
+
const p1 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils28.arrayify)(point));
|
5069
5238
|
const result = p0.add(p1);
|
5070
5239
|
return `0x${result.toHex(true)}`;
|
5071
5240
|
}
|
@@ -5077,16 +5246,16 @@ var Signer = class {
|
|
5077
5246
|
* @returns public key from signature from the
|
5078
5247
|
*/
|
5079
5248
|
static recoverPublicKey(data, signature) {
|
5080
|
-
const signedMessageBytes = (0,
|
5249
|
+
const signedMessageBytes = (0, import_utils28.arrayify)(signature);
|
5081
5250
|
const r = signedMessageBytes.slice(0, 32);
|
5082
5251
|
const s = signedMessageBytes.slice(32, 64);
|
5083
5252
|
const recoveryParam = (s[0] & 128) >> 7;
|
5084
5253
|
s[0] &= 127;
|
5085
|
-
const sig = new import_secp256k1.secp256k1.Signature(BigInt((0,
|
5254
|
+
const sig = new import_secp256k1.secp256k1.Signature(BigInt((0, import_utils28.hexlify)(r)), BigInt((0, import_utils28.hexlify)(s))).addRecoveryBit(
|
5086
5255
|
recoveryParam
|
5087
5256
|
);
|
5088
|
-
const publicKey = sig.recoverPublicKey((0,
|
5089
|
-
return (0,
|
5257
|
+
const publicKey = sig.recoverPublicKey((0, import_utils28.arrayify)(data)).toRawBytes(false).slice(1);
|
5258
|
+
return (0, import_utils28.hexlify)(publicKey);
|
5090
5259
|
}
|
5091
5260
|
/**
|
5092
5261
|
* Recover the address from a signature performed with [`sign`](#sign).
|
@@ -5105,7 +5274,7 @@ var Signer = class {
|
|
5105
5274
|
* @returns random 32-byte hashed
|
5106
5275
|
*/
|
5107
5276
|
static generatePrivateKey(entropy) {
|
5108
|
-
return entropy ? (0, import_hasher2.hash)((0,
|
5277
|
+
return entropy ? (0, import_hasher2.hash)((0, import_utils28.concat)([(0, import_crypto.randomBytes)(32), (0, import_utils28.arrayify)(entropy)])) : (0, import_crypto.randomBytes)(32);
|
5109
5278
|
}
|
5110
5279
|
/**
|
5111
5280
|
* Extended publicKey from a compact publicKey
|
@@ -5114,8 +5283,8 @@ var Signer = class {
|
|
5114
5283
|
* @returns extended publicKey
|
5115
5284
|
*/
|
5116
5285
|
static extendPublicKey(publicKey) {
|
5117
|
-
const point = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0,
|
5118
|
-
return (0,
|
5286
|
+
const point = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils28.arrayify)(publicKey));
|
5287
|
+
return (0, import_utils28.hexlify)(point.toRawBytes(false).slice(1));
|
5119
5288
|
}
|
5120
5289
|
};
|
5121
5290
|
|
@@ -5123,7 +5292,7 @@ var Signer = class {
|
|
5123
5292
|
var import_address6 = require("@fuel-ts/address");
|
5124
5293
|
var import_crypto2 = require("@fuel-ts/crypto");
|
5125
5294
|
var import_errors16 = require("@fuel-ts/errors");
|
5126
|
-
var
|
5295
|
+
var import_utils29 = require("@fuel-ts/utils");
|
5127
5296
|
var import_uuid = require("uuid");
|
5128
5297
|
var DEFAULT_KDF_PARAMS_LOG_N = 13;
|
5129
5298
|
var DEFAULT_KDF_PARAMS_R = 8;
|
@@ -5206,7 +5375,7 @@ async function decryptKeystoreWallet(jsonWallet, password) {
|
|
5206
5375
|
);
|
5207
5376
|
}
|
5208
5377
|
const buffer = await (0, import_crypto2.decryptJsonWalletData)(ciphertextBuffer, key, ivBuffer);
|
5209
|
-
const privateKey = (0,
|
5378
|
+
const privateKey = (0, import_utils29.hexlify)(buffer);
|
5210
5379
|
return privateKey;
|
5211
5380
|
}
|
5212
5381
|
|
@@ -5251,7 +5420,7 @@ var BaseWalletUnlocked = class extends Account {
|
|
5251
5420
|
*/
|
5252
5421
|
async signMessage(message) {
|
5253
5422
|
const signedMessage = await this.signer().sign((0, import_hasher3.hashMessage)(message));
|
5254
|
-
return signedMessage;
|
5423
|
+
return (0, import_utils30.hexlify)(signedMessage);
|
5255
5424
|
}
|
5256
5425
|
/**
|
5257
5426
|
* Signs a transaction with the wallet's private key.
|
@@ -5264,7 +5433,7 @@ var BaseWalletUnlocked = class extends Account {
|
|
5264
5433
|
const chainId = this.provider.getChain().consensusParameters.chainId.toNumber();
|
5265
5434
|
const hashedTransaction = transactionRequest.getTransactionId(chainId);
|
5266
5435
|
const signature = await this.signer().sign(hashedTransaction);
|
5267
|
-
return signature;
|
5436
|
+
return (0, import_utils30.hexlify)(signature);
|
5268
5437
|
}
|
5269
5438
|
/**
|
5270
5439
|
* Populates a transaction with the witnesses signature.
|
@@ -5284,12 +5453,14 @@ var BaseWalletUnlocked = class extends Account {
|
|
5284
5453
|
* @param transactionRequestLike - The transaction request to send.
|
5285
5454
|
* @returns A promise that resolves to the TransactionResponse object.
|
5286
5455
|
*/
|
5287
|
-
async sendTransaction(transactionRequestLike,
|
5456
|
+
async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, awaitExecution } = {}) {
|
5288
5457
|
const transactionRequest = transactionRequestify(transactionRequestLike);
|
5289
|
-
|
5458
|
+
if (estimateTxDependencies) {
|
5459
|
+
await this.provider.estimateTxDependencies(transactionRequest);
|
5460
|
+
}
|
5290
5461
|
return this.provider.sendTransaction(
|
5291
5462
|
await this.populateTransactionWitnessesSignature(transactionRequest),
|
5292
|
-
{
|
5463
|
+
{ awaitExecution, estimateTxDependencies: false }
|
5293
5464
|
);
|
5294
5465
|
}
|
5295
5466
|
/**
|
@@ -5298,9 +5469,11 @@ var BaseWalletUnlocked = class extends Account {
|
|
5298
5469
|
* @param transactionRequestLike - The transaction request to simulate.
|
5299
5470
|
* @returns A promise that resolves to the CallResult object.
|
5300
5471
|
*/
|
5301
|
-
async simulateTransaction(transactionRequestLike) {
|
5472
|
+
async simulateTransaction(transactionRequestLike, { estimateTxDependencies = true } = {}) {
|
5302
5473
|
const transactionRequest = transactionRequestify(transactionRequestLike);
|
5303
|
-
|
5474
|
+
if (estimateTxDependencies) {
|
5475
|
+
await this.provider.estimateTxDependencies(transactionRequest);
|
5476
|
+
}
|
5304
5477
|
return this.provider.call(
|
5305
5478
|
await this.populateTransactionWitnessesSignature(transactionRequest),
|
5306
5479
|
{
|
@@ -5321,12 +5494,14 @@ __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
|
|
5321
5494
|
// src/hdwallet/hdwallet.ts
|
5322
5495
|
var import_errors19 = require("@fuel-ts/errors");
|
5323
5496
|
var import_math19 = require("@fuel-ts/math");
|
5324
|
-
var
|
5497
|
+
var import_utils34 = require("@fuel-ts/utils");
|
5498
|
+
var import_ethers5 = require("ethers");
|
5325
5499
|
|
5326
5500
|
// src/mnemonic/mnemonic.ts
|
5327
5501
|
var import_crypto3 = require("@fuel-ts/crypto");
|
5328
5502
|
var import_errors18 = require("@fuel-ts/errors");
|
5329
|
-
var
|
5503
|
+
var import_utils32 = require("@fuel-ts/utils");
|
5504
|
+
var import_ethers4 = require("ethers");
|
5330
5505
|
|
5331
5506
|
// src/wordlists/words/english.ts
|
5332
5507
|
var english = [
|
@@ -7388,7 +7563,8 @@ var Language = /* @__PURE__ */ ((Language2) => {
|
|
7388
7563
|
|
7389
7564
|
// src/mnemonic/utils.ts
|
7390
7565
|
var import_errors17 = require("@fuel-ts/errors");
|
7391
|
-
var
|
7566
|
+
var import_utils31 = require("@fuel-ts/utils");
|
7567
|
+
var import_ethers3 = require("ethers");
|
7392
7568
|
function toUtf8Bytes(stri) {
|
7393
7569
|
const str = stri.normalize("NFKD");
|
7394
7570
|
const result = [];
|
@@ -7455,14 +7631,14 @@ function entropyToMnemonicIndices(entropy) {
|
|
7455
7631
|
}
|
7456
7632
|
}
|
7457
7633
|
const checksumBits = entropy.length / 4;
|
7458
|
-
const checksum = (0,
|
7634
|
+
const checksum = (0, import_utils31.arrayify)((0, import_ethers3.sha256)(entropy))[0] & getUpperMask(checksumBits);
|
7459
7635
|
indices[indices.length - 1] <<= checksumBits;
|
7460
7636
|
indices[indices.length - 1] |= checksum >> 8 - checksumBits;
|
7461
7637
|
return indices;
|
7462
7638
|
}
|
7463
7639
|
function mnemonicWordsToEntropy(words, wordlist) {
|
7464
7640
|
const size = Math.ceil(11 * words.length / 8);
|
7465
|
-
const entropy = (0,
|
7641
|
+
const entropy = (0, import_utils31.arrayify)(new Uint8Array(size));
|
7466
7642
|
let offset = 0;
|
7467
7643
|
for (let i = 0; i < words.length; i += 1) {
|
7468
7644
|
const index = wordlist.indexOf(words[i].normalize("NFKD"));
|
@@ -7482,7 +7658,7 @@ function mnemonicWordsToEntropy(words, wordlist) {
|
|
7482
7658
|
const entropyBits = 32 * words.length / 3;
|
7483
7659
|
const checksumBits = words.length / 3;
|
7484
7660
|
const checksumMask = getUpperMask(checksumBits);
|
7485
|
-
const checksum = (0,
|
7661
|
+
const checksum = (0, import_utils31.arrayify)((0, import_ethers3.sha256)(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
|
7486
7662
|
if (checksum !== (entropy[entropy.length - 1] & checksumMask)) {
|
7487
7663
|
throw new import_errors17.FuelError(
|
7488
7664
|
import_errors17.ErrorCode.INVALID_CHECKSUM,
|
@@ -7557,7 +7733,7 @@ var Mnemonic = class {
|
|
7557
7733
|
static mnemonicToEntropy(phrase, wordlist = english) {
|
7558
7734
|
const words = getWords(phrase);
|
7559
7735
|
assertMnemonic(words);
|
7560
|
-
return (0,
|
7736
|
+
return (0, import_utils32.hexlify)(mnemonicWordsToEntropy(words, wordlist));
|
7561
7737
|
}
|
7562
7738
|
/**
|
7563
7739
|
* @param entropy - Entropy source to the mnemonic phrase.
|
@@ -7565,7 +7741,7 @@ var Mnemonic = class {
|
|
7565
7741
|
* @returns 64-byte array contains privateKey and chainCode as described on BIP39
|
7566
7742
|
*/
|
7567
7743
|
static entropyToMnemonic(entropy, wordlist = english) {
|
7568
|
-
const entropyBytes = (0,
|
7744
|
+
const entropyBytes = (0, import_utils32.arrayify)(entropy);
|
7569
7745
|
assertWordList(wordlist);
|
7570
7746
|
assertEntropy(entropyBytes);
|
7571
7747
|
return entropyToMnemonicIndices(entropyBytes).map((i) => wordlist[i]).join(" ");
|
@@ -7579,7 +7755,7 @@ var Mnemonic = class {
|
|
7579
7755
|
assertMnemonic(getWords(phrase));
|
7580
7756
|
const phraseBytes = toUtf8Bytes(getPhrase(phrase));
|
7581
7757
|
const salt = toUtf8Bytes(`mnemonic${passphrase}`);
|
7582
|
-
return (0,
|
7758
|
+
return (0, import_ethers4.pbkdf2)(phraseBytes, salt, 2048, 64, "sha512");
|
7583
7759
|
}
|
7584
7760
|
/**
|
7585
7761
|
* @param phrase - Mnemonic phrase composed by words from the provided wordlist
|
@@ -7634,14 +7810,14 @@ var Mnemonic = class {
|
|
7634
7810
|
* @returns 64-byte array contains privateKey and chainCode as described on BIP39
|
7635
7811
|
*/
|
7636
7812
|
static masterKeysFromSeed(seed) {
|
7637
|
-
const seedArray = (0,
|
7813
|
+
const seedArray = (0, import_utils32.arrayify)(seed);
|
7638
7814
|
if (seedArray.length < 16 || seedArray.length > 64) {
|
7639
7815
|
throw new import_errors18.FuelError(
|
7640
7816
|
import_errors18.ErrorCode.INVALID_SEED,
|
7641
7817
|
`Seed length should be between 16 and 64 bytes, but received ${seedArray.length} bytes.`
|
7642
7818
|
);
|
7643
7819
|
}
|
7644
|
-
return (0,
|
7820
|
+
return (0, import_utils32.arrayify)((0, import_ethers4.computeHmac)("sha512", MasterSecret, seedArray));
|
7645
7821
|
}
|
7646
7822
|
/**
|
7647
7823
|
* Get the extendKey as defined on BIP-32 from the provided seed
|
@@ -7652,22 +7828,22 @@ var Mnemonic = class {
|
|
7652
7828
|
*/
|
7653
7829
|
static seedToExtendedKey(seed, testnet = false) {
|
7654
7830
|
const masterKey = Mnemonic.masterKeysFromSeed(seed);
|
7655
|
-
const prefix = (0,
|
7831
|
+
const prefix = (0, import_utils32.arrayify)(testnet ? TestnetPRV : MainnetPRV);
|
7656
7832
|
const depth = "0x00";
|
7657
7833
|
const fingerprint = "0x00000000";
|
7658
7834
|
const index = "0x00000000";
|
7659
7835
|
const chainCode = masterKey.slice(32);
|
7660
7836
|
const privateKey = masterKey.slice(0, 32);
|
7661
|
-
const extendedKey = (0,
|
7837
|
+
const extendedKey = (0, import_utils32.concat)([
|
7662
7838
|
prefix,
|
7663
7839
|
depth,
|
7664
7840
|
fingerprint,
|
7665
7841
|
index,
|
7666
7842
|
chainCode,
|
7667
|
-
(0,
|
7843
|
+
(0, import_utils32.concat)(["0x00", privateKey])
|
7668
7844
|
]);
|
7669
|
-
const checksum = (0,
|
7670
|
-
return (0,
|
7845
|
+
const checksum = (0, import_ethers4.dataSlice)((0, import_ethers4.sha256)((0, import_ethers4.sha256)(extendedKey)), 0, 4);
|
7846
|
+
return (0, import_ethers4.encodeBase58)((0, import_utils32.concat)([extendedKey, checksum]));
|
7671
7847
|
}
|
7672
7848
|
/**
|
7673
7849
|
* Create a new mnemonic using a randomly generated number as entropy.
|
@@ -7682,7 +7858,7 @@ var Mnemonic = class {
|
|
7682
7858
|
* @returns A randomly generated mnemonic
|
7683
7859
|
*/
|
7684
7860
|
static generate(size = 32, extraEntropy = "") {
|
7685
|
-
const entropy = extraEntropy ? (0,
|
7861
|
+
const entropy = extraEntropy ? (0, import_ethers4.sha256)((0, import_utils32.concat)([(0, import_crypto3.randomBytes)(size), (0, import_utils32.arrayify)(extraEntropy)])) : (0, import_crypto3.randomBytes)(size);
|
7686
7862
|
return Mnemonic.entropyToMnemonic(entropy);
|
7687
7863
|
}
|
7688
7864
|
};
|
@@ -7690,12 +7866,12 @@ var mnemonic_default = Mnemonic;
|
|
7690
7866
|
|
7691
7867
|
// src/hdwallet/hdwallet.ts
|
7692
7868
|
var HARDENED_INDEX = 2147483648;
|
7693
|
-
var MainnetPRV2 = (0,
|
7694
|
-
var MainnetPUB = (0,
|
7695
|
-
var TestnetPRV2 = (0,
|
7696
|
-
var TestnetPUB = (0,
|
7869
|
+
var MainnetPRV2 = (0, import_utils34.hexlify)("0x0488ade4");
|
7870
|
+
var MainnetPUB = (0, import_utils34.hexlify)("0x0488b21e");
|
7871
|
+
var TestnetPRV2 = (0, import_utils34.hexlify)("0x04358394");
|
7872
|
+
var TestnetPUB = (0, import_utils34.hexlify)("0x043587cf");
|
7697
7873
|
function base58check(data) {
|
7698
|
-
return (0,
|
7874
|
+
return (0, import_ethers5.encodeBase58)((0, import_utils34.concat)([data, (0, import_ethers5.dataSlice)((0, import_ethers5.sha256)((0, import_ethers5.sha256)(data)), 0, 4)]));
|
7699
7875
|
}
|
7700
7876
|
function getExtendedKeyPrefix(isPublic = false, testnet = false) {
|
7701
7877
|
if (isPublic) {
|
@@ -7704,11 +7880,11 @@ function getExtendedKeyPrefix(isPublic = false, testnet = false) {
|
|
7704
7880
|
return testnet ? TestnetPRV2 : MainnetPRV2;
|
7705
7881
|
}
|
7706
7882
|
function isPublicExtendedKey(extendedKey) {
|
7707
|
-
return [MainnetPUB, TestnetPUB].includes((0,
|
7883
|
+
return [MainnetPUB, TestnetPUB].includes((0, import_utils34.hexlify)(extendedKey.slice(0, 4)));
|
7708
7884
|
}
|
7709
7885
|
function isValidExtendedKey(extendedKey) {
|
7710
7886
|
return [MainnetPRV2, TestnetPRV2, MainnetPUB, TestnetPUB].includes(
|
7711
|
-
(0,
|
7887
|
+
(0, import_utils34.hexlify)(extendedKey.slice(0, 4))
|
7712
7888
|
);
|
7713
7889
|
}
|
7714
7890
|
function parsePath(path, depth = 0) {
|
@@ -7726,8 +7902,8 @@ function parsePath(path, depth = 0) {
|
|
7726
7902
|
var HDWallet = class {
|
7727
7903
|
depth = 0;
|
7728
7904
|
index = 0;
|
7729
|
-
fingerprint = (0,
|
7730
|
-
parentFingerprint = (0,
|
7905
|
+
fingerprint = (0, import_utils34.hexlify)("0x00000000");
|
7906
|
+
parentFingerprint = (0, import_utils34.hexlify)("0x00000000");
|
7731
7907
|
privateKey;
|
7732
7908
|
publicKey;
|
7733
7909
|
chainCode;
|
@@ -7739,8 +7915,8 @@ var HDWallet = class {
|
|
7739
7915
|
constructor(config) {
|
7740
7916
|
if (config.privateKey) {
|
7741
7917
|
const signer = new Signer(config.privateKey);
|
7742
|
-
this.publicKey = (0,
|
7743
|
-
this.privateKey = (0,
|
7918
|
+
this.publicKey = (0, import_utils34.hexlify)(signer.compressedPublicKey);
|
7919
|
+
this.privateKey = (0, import_utils34.hexlify)(config.privateKey);
|
7744
7920
|
} else {
|
7745
7921
|
if (!config.publicKey) {
|
7746
7922
|
throw new import_errors19.FuelError(
|
@@ -7748,10 +7924,10 @@ var HDWallet = class {
|
|
7748
7924
|
"Both public and private Key cannot be missing. At least one should be provided."
|
7749
7925
|
);
|
7750
7926
|
}
|
7751
|
-
this.publicKey = (0,
|
7927
|
+
this.publicKey = (0, import_utils34.hexlify)(config.publicKey);
|
7752
7928
|
}
|
7753
7929
|
this.parentFingerprint = config.parentFingerprint || this.parentFingerprint;
|
7754
|
-
this.fingerprint = (0,
|
7930
|
+
this.fingerprint = (0, import_ethers5.dataSlice)((0, import_ethers5.ripemd160)((0, import_ethers5.sha256)(this.publicKey)), 0, 4);
|
7755
7931
|
this.depth = config.depth || this.depth;
|
7756
7932
|
this.index = config.index || this.index;
|
7757
7933
|
this.chainCode = config.chainCode;
|
@@ -7767,9 +7943,9 @@ var HDWallet = class {
|
|
7767
7943
|
* @returns A new instance of HDWallet on the derived index
|
7768
7944
|
*/
|
7769
7945
|
deriveIndex(index) {
|
7770
|
-
const privateKey = this.privateKey && (0,
|
7771
|
-
const publicKey = (0,
|
7772
|
-
const chainCode = (0,
|
7946
|
+
const privateKey = this.privateKey && (0, import_utils34.arrayify)(this.privateKey);
|
7947
|
+
const publicKey = (0, import_utils34.arrayify)(this.publicKey);
|
7948
|
+
const chainCode = (0, import_utils34.arrayify)(this.chainCode);
|
7773
7949
|
const data = new Uint8Array(37);
|
7774
7950
|
if (index & HARDENED_INDEX) {
|
7775
7951
|
if (!privateKey) {
|
@@ -7780,10 +7956,10 @@ var HDWallet = class {
|
|
7780
7956
|
}
|
7781
7957
|
data.set(privateKey, 1);
|
7782
7958
|
} else {
|
7783
|
-
data.set((0,
|
7959
|
+
data.set((0, import_utils34.arrayify)(this.publicKey));
|
7784
7960
|
}
|
7785
7961
|
data.set((0, import_math19.toBytes)(index, 4), 33);
|
7786
|
-
const bytes = (0,
|
7962
|
+
const bytes = (0, import_utils34.arrayify)((0, import_ethers5.computeHmac)("sha512", chainCode, data));
|
7787
7963
|
const IL = bytes.slice(0, 32);
|
7788
7964
|
const IR = bytes.slice(32);
|
7789
7965
|
if (privateKey) {
|
@@ -7797,7 +7973,7 @@ var HDWallet = class {
|
|
7797
7973
|
parentFingerprint: this.fingerprint
|
7798
7974
|
});
|
7799
7975
|
}
|
7800
|
-
const signer = new Signer((0,
|
7976
|
+
const signer = new Signer((0, import_utils34.hexlify)(IL));
|
7801
7977
|
const Ki = signer.addPoint(publicKey);
|
7802
7978
|
return new HDWallet({
|
7803
7979
|
publicKey: Ki,
|
@@ -7832,14 +8008,12 @@ var HDWallet = class {
|
|
7832
8008
|
);
|
7833
8009
|
}
|
7834
8010
|
const prefix = getExtendedKeyPrefix(this.privateKey == null || isPublic, testnet);
|
7835
|
-
const depth = (0,
|
8011
|
+
const depth = (0, import_utils34.hexlify)(Uint8Array.from([this.depth]));
|
7836
8012
|
const parentFingerprint = this.parentFingerprint;
|
7837
8013
|
const index = (0, import_math19.toHex)(this.index, 4);
|
7838
8014
|
const chainCode = this.chainCode;
|
7839
|
-
const key = this.privateKey != null && !isPublic ? (0,
|
7840
|
-
const extendedKey = (0,
|
7841
|
-
(0, import_ethers26.concat)([prefix, depth, parentFingerprint, index, chainCode, key])
|
7842
|
-
);
|
8015
|
+
const key = this.privateKey != null && !isPublic ? (0, import_utils34.concat)(["0x00", this.privateKey]) : this.publicKey;
|
8016
|
+
const extendedKey = (0, import_utils34.arrayify)((0, import_utils34.concat)([prefix, depth, parentFingerprint, index, chainCode, key]));
|
7843
8017
|
return base58check(extendedKey);
|
7844
8018
|
}
|
7845
8019
|
/**
|
@@ -7851,13 +8025,13 @@ var HDWallet = class {
|
|
7851
8025
|
static fromSeed(seed) {
|
7852
8026
|
const masterKey = mnemonic_default.masterKeysFromSeed(seed);
|
7853
8027
|
return new HDWallet({
|
7854
|
-
chainCode: (0,
|
7855
|
-
privateKey: (0,
|
8028
|
+
chainCode: (0, import_utils34.arrayify)(masterKey.slice(32)),
|
8029
|
+
privateKey: (0, import_utils34.arrayify)(masterKey.slice(0, 32))
|
7856
8030
|
});
|
7857
8031
|
}
|
7858
8032
|
static fromExtendedKey(extendedKey) {
|
7859
|
-
const decoded = (0,
|
7860
|
-
const bytes = (0,
|
8033
|
+
const decoded = (0, import_ethers5.toBeHex)((0, import_ethers5.decodeBase58)(extendedKey));
|
8034
|
+
const bytes = (0, import_utils34.arrayify)(decoded);
|
7861
8035
|
const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
|
7862
8036
|
if (bytes.length !== 82 || !isValidExtendedKey(bytes)) {
|
7863
8037
|
throw new import_errors19.FuelError(import_errors19.ErrorCode.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
|
@@ -7866,9 +8040,9 @@ var HDWallet = class {
|
|
7866
8040
|
throw new import_errors19.FuelError(import_errors19.ErrorCode.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
|
7867
8041
|
}
|
7868
8042
|
const depth = bytes[4];
|
7869
|
-
const parentFingerprint = (0,
|
7870
|
-
const index = parseInt((0,
|
7871
|
-
const chainCode = (0,
|
8043
|
+
const parentFingerprint = (0, import_utils34.hexlify)(bytes.slice(5, 9));
|
8044
|
+
const index = parseInt((0, import_utils34.hexlify)(bytes.slice(9, 13)).substring(2), 16);
|
8045
|
+
const chainCode = (0, import_utils34.hexlify)(bytes.slice(13, 45));
|
7872
8046
|
const key = bytes.slice(45, 78);
|
7873
8047
|
if (depth === 0 && parentFingerprint !== "0x00000000" || depth === 0 && index !== 0) {
|
7874
8048
|
throw new import_errors19.FuelError(
|
@@ -8474,19 +8648,18 @@ var import_address10 = require("@fuel-ts/address");
|
|
8474
8648
|
var import_configs11 = require("@fuel-ts/address/configs");
|
8475
8649
|
var import_errors24 = require("@fuel-ts/errors");
|
8476
8650
|
var import_transactions19 = require("@fuel-ts/transactions");
|
8477
|
-
var
|
8651
|
+
var import_utils36 = require("@fuel-ts/utils");
|
8478
8652
|
|
8479
8653
|
// src/predicate/utils/getPredicateRoot.ts
|
8480
8654
|
var import_hasher4 = require("@fuel-ts/hasher");
|
8481
8655
|
var import_merkle = require("@fuel-ts/merkle");
|
8482
|
-
var
|
8483
|
-
var import_ethers27 = require("ethers");
|
8656
|
+
var import_utils35 = require("@fuel-ts/utils");
|
8484
8657
|
var getPredicateRoot = (bytecode) => {
|
8485
8658
|
const chunkSize = 16 * 1024;
|
8486
|
-
const bytes = (0,
|
8487
|
-
const chunks = (0,
|
8488
|
-
const codeRoot = (0, import_merkle.calcRoot)(chunks.map((c) => (0,
|
8489
|
-
const predicateRoot = (0, import_hasher4.hash)((0,
|
8659
|
+
const bytes = (0, import_utils35.arrayify)(bytecode);
|
8660
|
+
const chunks = (0, import_utils35.chunkAndPadBytes)(bytes, chunkSize);
|
8661
|
+
const codeRoot = (0, import_merkle.calcRoot)(chunks.map((c) => (0, import_utils35.hexlify)(c)));
|
8662
|
+
const predicateRoot = (0, import_hasher4.hash)((0, import_utils35.concat)(["0x4655454C", codeRoot]));
|
8490
8663
|
return predicateRoot;
|
8491
8664
|
};
|
8492
8665
|
|
@@ -8525,7 +8698,7 @@ var Predicate = class extends Account {
|
|
8525
8698
|
const request = transactionRequestify(transactionRequestLike);
|
8526
8699
|
const { policies } = BaseTransactionRequest.getPolicyMeta(request);
|
8527
8700
|
request.inputs?.forEach((input) => {
|
8528
|
-
if (input.type === import_transactions19.InputType.Coin && (0,
|
8701
|
+
if (input.type === import_transactions19.InputType.Coin && (0, import_utils36.hexlify)(input.owner) === this.address.toB256()) {
|
8529
8702
|
input.predicate = this.bytes;
|
8530
8703
|
input.predicateData = this.getPredicateData(policies.length);
|
8531
8704
|
}
|
@@ -8596,7 +8769,7 @@ var Predicate = class extends Account {
|
|
8596
8769
|
* @returns An object containing the new predicate bytes and interface.
|
8597
8770
|
*/
|
8598
8771
|
static processPredicateData(bytes, jsonAbi, configurableConstants) {
|
8599
|
-
let predicateBytes = (0,
|
8772
|
+
let predicateBytes = (0, import_utils36.arrayify)(bytes);
|
8600
8773
|
let abiInterface;
|
8601
8774
|
if (jsonAbi) {
|
8602
8775
|
abiInterface = new import_abi_coder5.Interface(jsonAbi);
|
@@ -8656,6 +8829,9 @@ var Predicate = class extends Account {
|
|
8656
8829
|
}
|
8657
8830
|
};
|
8658
8831
|
|
8832
|
+
// src/connectors/fuel.ts
|
8833
|
+
var import_errors25 = require("@fuel-ts/errors");
|
8834
|
+
|
8659
8835
|
// src/connectors/fuel-connector.ts
|
8660
8836
|
var import_events2 = require("events");
|
8661
8837
|
|
@@ -8696,14 +8872,6 @@ var FuelConnectorEventTypes = /* @__PURE__ */ ((FuelConnectorEventTypes2) => {
|
|
8696
8872
|
})(FuelConnectorEventTypes || {});
|
8697
8873
|
var FuelConnectorEventType = "FuelConnector";
|
8698
8874
|
|
8699
|
-
// src/connectors/types/constants.ts
|
8700
|
-
var CONNECTOR_SCRIPT = "FuelConnectorScript";
|
8701
|
-
var CONTENT_SCRIPT_NAME = "FuelContentScript";
|
8702
|
-
var BACKGROUND_SCRIPT_NAME = "FuelBackgroundScript";
|
8703
|
-
var POPUP_SCRIPT_NAME = "FuelPopUpScript";
|
8704
|
-
var VAULT_SCRIPT_NAME = "FuelVaultScript";
|
8705
|
-
var EVENT_MESSAGE = "message";
|
8706
|
-
|
8707
8875
|
// src/connectors/types/data-type.ts
|
8708
8876
|
var MessageTypes = /* @__PURE__ */ ((MessageTypes2) => {
|
8709
8877
|
MessageTypes2["ping"] = "ping";
|
@@ -8953,40 +9121,6 @@ var FuelConnector = class extends import_events2.EventEmitter {
|
|
8953
9121
|
}
|
8954
9122
|
};
|
8955
9123
|
|
8956
|
-
// src/connectors/fuel-wallet-locked.ts
|
8957
|
-
var FuelWalletLocked = class extends WalletLocked {
|
8958
|
-
connector;
|
8959
|
-
_provider;
|
8960
|
-
constructor(address, connector, provider) {
|
8961
|
-
super(address, provider);
|
8962
|
-
this.connector = connector;
|
8963
|
-
this._provider = provider;
|
8964
|
-
}
|
8965
|
-
async signMessage(message) {
|
8966
|
-
return this.connector.signMessage(this.address.toString(), message);
|
8967
|
-
}
|
8968
|
-
async sendTransaction(transaction) {
|
8969
|
-
const transactionId = await this.connector.sendTransaction(
|
8970
|
-
this.address.toString(),
|
8971
|
-
transaction
|
8972
|
-
);
|
8973
|
-
return this.provider.getTransactionResponse(transactionId);
|
8974
|
-
}
|
8975
|
-
};
|
8976
|
-
|
8977
|
-
// src/connectors/fuel-wallet-provider.ts
|
8978
|
-
var FuelWalletProvider = class extends Provider {
|
8979
|
-
static async create(url, options) {
|
8980
|
-
const provider = new FuelWalletProvider(url, options);
|
8981
|
-
await provider.fetchChainAndNodeInfo();
|
8982
|
-
return provider;
|
8983
|
-
}
|
8984
|
-
// eslint-disable-next-line @typescript-eslint/require-await
|
8985
|
-
async getTransactionResponse(transactionId) {
|
8986
|
-
return new TransactionResponse(transactionId, this);
|
8987
|
-
}
|
8988
|
-
};
|
8989
|
-
|
8990
9124
|
// src/connectors/utils/cache.ts
|
8991
9125
|
function cacheFor(fn, { cache: cache2, cacheTime, key }) {
|
8992
9126
|
return async (...args) => {
|
@@ -9016,23 +9150,6 @@ function dispatchFuelConnectorEvent(connector) {
|
|
9016
9150
|
);
|
9017
9151
|
}
|
9018
9152
|
|
9019
|
-
// src/connectors/utils/get-asset-by-chain.ts
|
9020
|
-
function getAssetByChain(asset, chainId, network = "fuel") {
|
9021
|
-
const assetFuelNetwork = asset.networks.find(
|
9022
|
-
(item) => item.chainId === chainId && item.type === network
|
9023
|
-
);
|
9024
|
-
if (!assetFuelNetwork) {
|
9025
|
-
throw new Error("Asset not found for the given chain and network.");
|
9026
|
-
}
|
9027
|
-
return {
|
9028
|
-
...asset,
|
9029
|
-
assetId: assetFuelNetwork.assetId,
|
9030
|
-
decimals: assetFuelNetwork.decimals,
|
9031
|
-
chainId: assetFuelNetwork.chainId,
|
9032
|
-
network: assetFuelNetwork.type
|
9033
|
-
};
|
9034
|
-
}
|
9035
|
-
|
9036
9153
|
// src/connectors/utils/promises.ts
|
9037
9154
|
function deferPromise() {
|
9038
9155
|
const defer = {};
|
@@ -9054,6 +9171,7 @@ async function withTimeout(promise, timeout = 1050) {
|
|
9054
9171
|
// src/connectors/fuel.ts
|
9055
9172
|
var HAS_CONNECTOR_TIMEOUT = 2e3;
|
9056
9173
|
var PING_CACHE_TIME = 5e3;
|
9174
|
+
var { warn } = console;
|
9057
9175
|
var _Fuel = class extends FuelConnector {
|
9058
9176
|
_storage = null;
|
9059
9177
|
_connectors = [];
|
@@ -9322,14 +9440,12 @@ var _Fuel = class extends FuelConnector {
|
|
9322
9440
|
* Return a Fuel Provider instance with extends features to work with
|
9323
9441
|
* connectors.
|
9324
9442
|
*
|
9325
|
-
* @deprecated
|
9443
|
+
* @deprecated getProvider is deprecated and is going to be removed in the future, use getWallet instead.
|
9326
9444
|
*/
|
9327
9445
|
async getProvider(providerOrNetwork) {
|
9328
|
-
|
9329
|
-
|
9330
|
-
|
9331
|
-
);
|
9332
|
-
}
|
9446
|
+
warn(
|
9447
|
+
"getProvider is deprecated and is going to be removed in the future, use getWallet instead."
|
9448
|
+
);
|
9333
9449
|
return this._getProvider(providerOrNetwork);
|
9334
9450
|
}
|
9335
9451
|
/**
|
@@ -9341,12 +9457,12 @@ var _Fuel = class extends FuelConnector {
|
|
9341
9457
|
if (providerOrNetwork && "getTransactionResponse" in providerOrNetwork) {
|
9342
9458
|
provider = providerOrNetwork;
|
9343
9459
|
} else if (providerOrNetwork && "chainId" in providerOrNetwork && "url" in providerOrNetwork) {
|
9344
|
-
provider = await
|
9460
|
+
provider = await Provider.create(providerOrNetwork.url);
|
9345
9461
|
} else if (!providerOrNetwork) {
|
9346
9462
|
const currentNetwork = await this.currentNetwork();
|
9347
|
-
provider = await
|
9463
|
+
provider = await Provider.create(currentNetwork.url);
|
9348
9464
|
} else {
|
9349
|
-
throw new
|
9465
|
+
throw new import_errors25.FuelError(import_errors25.ErrorCode.INVALID_PROVIDER, "Provider is not valid.");
|
9350
9466
|
}
|
9351
9467
|
return provider;
|
9352
9468
|
}
|
@@ -9356,7 +9472,7 @@ var _Fuel = class extends FuelConnector {
|
|
9356
9472
|
*/
|
9357
9473
|
async getWallet(address, providerOrNetwork) {
|
9358
9474
|
const provider = await this._getProvider(providerOrNetwork);
|
9359
|
-
return new
|
9475
|
+
return new Account(address, provider, this);
|
9360
9476
|
}
|
9361
9477
|
/**
|
9362
9478
|
* Remove all open listeners this is useful when you want to
|
@@ -9388,22 +9504,17 @@ __publicField(Fuel, "defaultConfig", {});
|
|
9388
9504
|
0 && (module.exports = {
|
9389
9505
|
Account,
|
9390
9506
|
AddressType,
|
9391
|
-
BACKGROUND_SCRIPT_NAME,
|
9392
9507
|
BaseTransactionRequest,
|
9393
9508
|
BaseWalletUnlocked,
|
9394
|
-
|
9395
|
-
CONTENT_SCRIPT_NAME,
|
9509
|
+
CHAIN_IDS,
|
9396
9510
|
ChainName,
|
9397
9511
|
ChangeOutputCollisionError,
|
9398
9512
|
CreateTransactionRequest,
|
9399
|
-
EVENT_MESSAGE,
|
9400
9513
|
Fuel,
|
9401
9514
|
FuelConnector,
|
9402
9515
|
FuelConnectorEventType,
|
9403
9516
|
FuelConnectorEventTypes,
|
9404
9517
|
FuelConnectorMethods,
|
9405
|
-
FuelWalletLocked,
|
9406
|
-
FuelWalletProvider,
|
9407
9518
|
HDWallet,
|
9408
9519
|
Language,
|
9409
9520
|
LocalStorage,
|
@@ -9415,7 +9526,6 @@ __publicField(Fuel, "defaultConfig", {});
|
|
9415
9526
|
NoWitnessAtIndexError,
|
9416
9527
|
NoWitnessByOwnerError,
|
9417
9528
|
OperationName,
|
9418
|
-
POPUP_SCRIPT_NAME,
|
9419
9529
|
Predicate,
|
9420
9530
|
PrivateKeyVault,
|
9421
9531
|
Provider,
|
@@ -9426,7 +9536,6 @@ __publicField(Fuel, "defaultConfig", {});
|
|
9426
9536
|
TransactionStatus,
|
9427
9537
|
TransactionType,
|
9428
9538
|
TransactionTypeName,
|
9429
|
-
VAULT_SCRIPT_NAME,
|
9430
9539
|
Vault,
|
9431
9540
|
Wallet,
|
9432
9541
|
WalletLocked,
|
@@ -9436,6 +9545,7 @@ __publicField(Fuel, "defaultConfig", {});
|
|
9436
9545
|
addOperation,
|
9437
9546
|
assembleReceiptByType,
|
9438
9547
|
assembleTransactionSummary,
|
9548
|
+
assets,
|
9439
9549
|
buildBlockExplorerUrl,
|
9440
9550
|
cacheFor,
|
9441
9551
|
calculateMetadataGasForTxCreate,
|
@@ -9453,11 +9563,15 @@ __publicField(Fuel, "defaultConfig", {});
|
|
9453
9563
|
fromTai64ToUnix,
|
9454
9564
|
fromUnixToTai64,
|
9455
9565
|
gasUsedByInputs,
|
9456
|
-
|
9566
|
+
getAssetEth,
|
9567
|
+
getAssetFuel,
|
9568
|
+
getAssetNetwork,
|
9569
|
+
getAssetWithNetwork,
|
9457
9570
|
getContractCallOperations,
|
9458
9571
|
getContractCreatedOperations,
|
9459
9572
|
getContractTransferOperations,
|
9460
9573
|
getDecodedLogs,
|
9574
|
+
getDefaultChainId,
|
9461
9575
|
getGasUsedFromReceipts,
|
9462
9576
|
getInputAccountAddress,
|
9463
9577
|
getInputContractFromIndex,
|
@@ -9506,9 +9620,11 @@ __publicField(Fuel, "defaultConfig", {});
|
|
9506
9620
|
processGqlReceipt,
|
9507
9621
|
processGraphqlStatus,
|
9508
9622
|
resolveGasDependentCosts,
|
9623
|
+
resolveIconPaths,
|
9509
9624
|
returnZeroScript,
|
9510
9625
|
sleep,
|
9511
9626
|
transactionRequestify,
|
9627
|
+
urlJoin,
|
9512
9628
|
withTimeout,
|
9513
9629
|
withdrawScript
|
9514
9630
|
});
|