@funkit/core 2.3.30 → 2.3.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +23 -8
- package/dist/index.js.map +2 -2
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -12056,7 +12056,9 @@ var Chain = class _Chain {
|
|
|
12056
12056
|
return _Chain.chain;
|
|
12057
12057
|
}
|
|
12058
12058
|
async init(options) {
|
|
12059
|
-
if (this.initialized)
|
|
12059
|
+
if (this.initialized) {
|
|
12060
|
+
return;
|
|
12061
|
+
}
|
|
12060
12062
|
if (this.id) {
|
|
12061
12063
|
await this.loadChain(this.id, options);
|
|
12062
12064
|
} else if (this.name) {
|
|
@@ -13043,7 +13045,9 @@ var convertProviderToClient = ({
|
|
|
13043
13045
|
transport: custom(provider)
|
|
13044
13046
|
});
|
|
13045
13047
|
}
|
|
13046
|
-
if (!provider.send)
|
|
13048
|
+
if (!provider.send) {
|
|
13049
|
+
throw new Error("Provider isn't EIP 1193 compliant");
|
|
13050
|
+
}
|
|
13047
13051
|
return createWalletClient({
|
|
13048
13052
|
chain,
|
|
13049
13053
|
transport: custom({
|
|
@@ -13160,7 +13164,9 @@ var Auth = class {
|
|
|
13160
13164
|
}
|
|
13161
13165
|
}
|
|
13162
13166
|
async init() {
|
|
13163
|
-
if (this.inited)
|
|
13167
|
+
if (this.inited) {
|
|
13168
|
+
return;
|
|
13169
|
+
}
|
|
13164
13170
|
if (this.client) {
|
|
13165
13171
|
const address = await this.client.requestAddresses();
|
|
13166
13172
|
this.account = address[0];
|
|
@@ -13219,7 +13225,9 @@ var Auth = class {
|
|
|
13219
13225
|
*/
|
|
13220
13226
|
async getAddress() {
|
|
13221
13227
|
await this.init();
|
|
13222
|
-
if (this.account)
|
|
13228
|
+
if (this.account) {
|
|
13229
|
+
return this.account;
|
|
13230
|
+
}
|
|
13223
13231
|
throw new Error("No signer or client");
|
|
13224
13232
|
}
|
|
13225
13233
|
/**
|
|
@@ -13423,12 +13431,15 @@ import { decodeAbiParameters as decodeAbiParameters2, pad as pad5, toBytes as to
|
|
|
13423
13431
|
// src/utils/ViemUtils.ts
|
|
13424
13432
|
import { getAbiItem, toFunctionSelector } from "viem";
|
|
13425
13433
|
function formatAbiItem(abiItem, { includeName = false } = {}) {
|
|
13426
|
-
if (abiItem.type !== "function" && abiItem.type !== "event" && abiItem.type !== "error")
|
|
13434
|
+
if (abiItem.type !== "function" && abiItem.type !== "event" && abiItem.type !== "error") {
|
|
13427
13435
|
throw new Error(`InvalidDefinitionTypeError: ${abiItem.type}`);
|
|
13436
|
+
}
|
|
13428
13437
|
return `${abiItem.name}(${formatAbiParams(abiItem.inputs, { includeName })})`;
|
|
13429
13438
|
}
|
|
13430
13439
|
function formatAbiParams(params, { includeName = false } = {}) {
|
|
13431
|
-
if (!params)
|
|
13440
|
+
if (!params) {
|
|
13441
|
+
return "";
|
|
13442
|
+
}
|
|
13432
13443
|
return params.map((param) => formatAbiParam(param, { includeName })).join(includeName ? ", " : ",");
|
|
13433
13444
|
}
|
|
13434
13445
|
function formatAbiParam(param, { includeName }) {
|
|
@@ -13442,7 +13453,9 @@ function formatAbiParam(param, { includeName }) {
|
|
|
13442
13453
|
}
|
|
13443
13454
|
var getSigHash = (abi, functionName) => {
|
|
13444
13455
|
const abiItem = getAbiItem({ abi, name: functionName });
|
|
13445
|
-
if (!abiItem)
|
|
13456
|
+
if (!abiItem) {
|
|
13457
|
+
throw new Error("Unable to retrieve abi");
|
|
13458
|
+
}
|
|
13446
13459
|
const definition = formatAbiItem(abiItem);
|
|
13447
13460
|
return toFunctionSelector(definition);
|
|
13448
13461
|
};
|
|
@@ -16580,7 +16593,9 @@ var FunWallet = class extends FirstClassActions {
|
|
|
16580
16593
|
nonce: BigInt(operation.userOp.nonce)
|
|
16581
16594
|
}
|
|
16582
16595
|
);
|
|
16583
|
-
if (rejectionMessage)
|
|
16596
|
+
if (rejectionMessage) {
|
|
16597
|
+
rejectOperation.message = rejectionMessage;
|
|
16598
|
+
}
|
|
16584
16599
|
rejectOperation.relatedOpIds = [operation.opId ?? "0x"];
|
|
16585
16600
|
rejectOperation.opType = OperationType.REJECTION;
|
|
16586
16601
|
rejectOperation.opId = await createOp({
|