anymal-protocol 1.0.114 → 1.0.116

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.
@@ -0,0 +1,93 @@
1
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
+ }) : x)(function(x) {
4
+ if (typeof require !== "undefined") return require.apply(this, arguments);
5
+ throw Error('Dynamic require of "' + x + '" is not supported');
6
+ });
7
+
8
+ // src/helpers/CryptoUtils.tsx
9
+ import { ec as EC } from "elliptic";
10
+ var ec = new EC("secp256k1");
11
+ var Network = /* @__PURE__ */ ((Network2) => {
12
+ Network2["Testnet"] = "testnet";
13
+ Network2["Localnet"] = "localnet";
14
+ return Network2;
15
+ })(Network || {});
16
+ var NETWORK_HOSTS = {
17
+ ["testnet" /* Testnet */]: "https://dev-db.petastic.com",
18
+ ["localnet" /* Localnet */]: "http://host.docker.internal:9181"
19
+ };
20
+ function loadExistingSecp256k1PrivateKey(hexKey) {
21
+ if (!hexKey) {
22
+ throw new Error("Private key hex must be provided");
23
+ }
24
+ return ec.keyFromPrivate(hexKey, "hex");
25
+ }
26
+ function serializePublicKeyCompressed(keyPair) {
27
+ return keyPair.getPublic(true, "hex");
28
+ }
29
+ function base64url(input) {
30
+ let buf;
31
+ if (typeof input === "string") buf = Buffer.from(input);
32
+ else if (input instanceof ArrayBuffer) buf = Buffer.from(input);
33
+ else buf = input;
34
+ return buf.toString("base64").replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
35
+ }
36
+ function sha256HashNode(data) {
37
+ const { createHash } = __require("crypto");
38
+ return createHash("sha256").update(data).digest();
39
+ }
40
+ async function hashInput(data) {
41
+ if (typeof window !== "undefined" && window.crypto?.subtle) {
42
+ const encoder = new TextEncoder();
43
+ const encoded = encoder.encode(data);
44
+ const hashBuffer = await window.crypto.subtle.digest("SHA-256", encoded);
45
+ return Buffer.from(hashBuffer);
46
+ } else {
47
+ return sha256HashNode(data);
48
+ }
49
+ }
50
+ async function generateJWT(sub, aud, keyPair, expiresInSeconds = 24 * 60 * 60) {
51
+ const iat = Math.floor(Date.now() / 1e3);
52
+ const exp = iat + expiresInSeconds;
53
+ const header = { alg: "ES256", typ: "JWT" };
54
+ const payload = { sub, aud, iat, exp };
55
+ const encodedHeader = base64url(JSON.stringify(header));
56
+ const encodedPayload = base64url(JSON.stringify(payload));
57
+ const signingInput = `${encodedHeader}.${encodedPayload}`;
58
+ const hash = await hashInput(signingInput);
59
+ const signature = keyPair.sign(hash, { canonical: true });
60
+ const rBuf = signature.r.toArrayLike(Buffer, "be", 32);
61
+ const sBuf = signature.s.toArrayLike(Buffer, "be", 32);
62
+ const rawSig = Buffer.concat([rBuf, sBuf]);
63
+ const encodedSig = base64url(rawSig);
64
+ return `${signingInput}.${encodedSig}`;
65
+ }
66
+ async function createAuthEnvelope(privateKeyHex, network = "testnet" /* Testnet */, options) {
67
+ const keyPair = loadExistingSecp256k1PrivateKey(privateKeyHex);
68
+ const publicKey = serializePublicKeyCompressed(keyPair);
69
+ const host = NETWORK_HOSTS[network];
70
+ if (!host) {
71
+ throw new Error(`Unsupported network: ${network}`);
72
+ }
73
+ const token = await generateJWT(publicKey, host, keyPair, options?.expiresInSeconds);
74
+ return { publicKey, token };
75
+ }
76
+ async function generateAppSignature(privateKeyHex, clientId, redirectUri, state) {
77
+ const keyPair = loadExistingSecp256k1PrivateKey(privateKeyHex);
78
+ const message = `${clientId}:${redirectUri}:${state}`;
79
+ const hash = await hashInput(message);
80
+ const signatureDER = keyPair.sign(hash, { canonical: true }).toDER();
81
+ return Buffer.from(signatureDER).toString("hex");
82
+ }
83
+
84
+ export {
85
+ __require,
86
+ Network,
87
+ NETWORK_HOSTS,
88
+ loadExistingSecp256k1PrivateKey,
89
+ serializePublicKeyCompressed,
90
+ generateJWT,
91
+ createAuthEnvelope,
92
+ generateAppSignature
93
+ };
@@ -0,0 +1,93 @@
1
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
+ }) : x)(function(x) {
4
+ if (typeof require !== "undefined") return require.apply(this, arguments);
5
+ throw Error('Dynamic require of "' + x + '" is not supported');
6
+ });
7
+
8
+ // src/helpers/CryptoUtils.tsx
9
+ import { ec as EC } from "elliptic";
10
+ var ec = new EC("secp256k1");
11
+ var Network = /* @__PURE__ */ ((Network2) => {
12
+ Network2["Testnet"] = "testnet";
13
+ Network2["Localnet"] = "localnet";
14
+ return Network2;
15
+ })(Network || {});
16
+ var NETWORK_HOSTS = {
17
+ ["testnet" /* Testnet */]: "https://dev-db.petastic.com",
18
+ ["localnet" /* Localnet */]: "http://docker.host.internal:9181"
19
+ };
20
+ function loadExistingSecp256k1PrivateKey(hexKey) {
21
+ if (!hexKey) {
22
+ throw new Error("Private key hex must be provided");
23
+ }
24
+ return ec.keyFromPrivate(hexKey, "hex");
25
+ }
26
+ function serializePublicKeyCompressed(keyPair) {
27
+ return keyPair.getPublic(true, "hex");
28
+ }
29
+ function base64url(input) {
30
+ let buf;
31
+ if (typeof input === "string") buf = Buffer.from(input);
32
+ else if (input instanceof ArrayBuffer) buf = Buffer.from(input);
33
+ else buf = input;
34
+ return buf.toString("base64").replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
35
+ }
36
+ function sha256HashNode(data) {
37
+ const { createHash } = __require("crypto");
38
+ return createHash("sha256").update(data).digest();
39
+ }
40
+ async function hashInput(data) {
41
+ if (typeof window !== "undefined" && window.crypto?.subtle) {
42
+ const encoder = new TextEncoder();
43
+ const encoded = encoder.encode(data);
44
+ const hashBuffer = await window.crypto.subtle.digest("SHA-256", encoded);
45
+ return Buffer.from(hashBuffer);
46
+ } else {
47
+ return sha256HashNode(data);
48
+ }
49
+ }
50
+ async function generateJWT(sub, aud, keyPair, expiresInSeconds = 24 * 60 * 60) {
51
+ const iat = Math.floor(Date.now() / 1e3);
52
+ const exp = iat + expiresInSeconds;
53
+ const header = { alg: "ES256", typ: "JWT" };
54
+ const payload = { sub, aud, iat, exp };
55
+ const encodedHeader = base64url(JSON.stringify(header));
56
+ const encodedPayload = base64url(JSON.stringify(payload));
57
+ const signingInput = `${encodedHeader}.${encodedPayload}`;
58
+ const hash = await hashInput(signingInput);
59
+ const signature = keyPair.sign(hash, { canonical: true });
60
+ const rBuf = signature.r.toArrayLike(Buffer, "be", 32);
61
+ const sBuf = signature.s.toArrayLike(Buffer, "be", 32);
62
+ const rawSig = Buffer.concat([rBuf, sBuf]);
63
+ const encodedSig = base64url(rawSig);
64
+ return `${signingInput}.${encodedSig}`;
65
+ }
66
+ async function createAuthEnvelope(privateKeyHex, network = "testnet" /* Testnet */, options) {
67
+ const keyPair = loadExistingSecp256k1PrivateKey(privateKeyHex);
68
+ const publicKey = serializePublicKeyCompressed(keyPair);
69
+ const host = NETWORK_HOSTS[network];
70
+ if (!host) {
71
+ throw new Error(`Unsupported network: ${network}`);
72
+ }
73
+ const token = await generateJWT(publicKey, host, keyPair, options?.expiresInSeconds);
74
+ return { publicKey, token };
75
+ }
76
+ async function generateAppSignature(privateKeyHex, clientId, redirectUri, state) {
77
+ const keyPair = loadExistingSecp256k1PrivateKey(privateKeyHex);
78
+ const message = `${clientId}:${redirectUri}:${state}`;
79
+ const hash = await hashInput(message);
80
+ const signatureDER = keyPair.sign(hash, { canonical: true }).toDER();
81
+ return Buffer.from(signatureDER).toString("hex");
82
+ }
83
+
84
+ export {
85
+ __require,
86
+ Network,
87
+ NETWORK_HOSTS,
88
+ loadExistingSecp256k1PrivateKey,
89
+ serializePublicKeyCompressed,
90
+ generateJWT,
91
+ createAuthEnvelope,
92
+ generateAppSignature
93
+ };
@@ -0,0 +1,91 @@
1
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
+ }) : x)(function(x) {
4
+ if (typeof require !== "undefined") return require.apply(this, arguments);
5
+ throw Error('Dynamic require of "' + x + '" is not supported');
6
+ });
7
+
8
+ // src/helpers/CryptoUtils.tsx
9
+ import { ec as EC } from "elliptic";
10
+ var ec = new EC("secp256k1");
11
+ var Network = /* @__PURE__ */ ((Network2) => {
12
+ Network2["Testnet"] = "testnet";
13
+ return Network2;
14
+ })(Network || {});
15
+ var NETWORK_HOSTS = {
16
+ ["testnet" /* Testnet */]: "https://dev-db.petastic.com"
17
+ };
18
+ function loadExistingSecp256k1PrivateKey(hexKey) {
19
+ if (!hexKey) {
20
+ throw new Error("Private key hex must be provided");
21
+ }
22
+ return ec.keyFromPrivate(hexKey, "hex");
23
+ }
24
+ function serializePublicKeyCompressed(keyPair) {
25
+ return keyPair.getPublic(true, "hex");
26
+ }
27
+ function base64url(input) {
28
+ let buf;
29
+ if (typeof input === "string") buf = Buffer.from(input);
30
+ else if (input instanceof ArrayBuffer) buf = Buffer.from(input);
31
+ else buf = input;
32
+ return buf.toString("base64").replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
33
+ }
34
+ function sha256HashNode(data) {
35
+ const { createHash } = __require("crypto");
36
+ return createHash("sha256").update(data).digest();
37
+ }
38
+ async function hashInput(data) {
39
+ if (typeof window !== "undefined" && window.crypto?.subtle) {
40
+ const encoder = new TextEncoder();
41
+ const encoded = encoder.encode(data);
42
+ const hashBuffer = await window.crypto.subtle.digest("SHA-256", encoded);
43
+ return Buffer.from(hashBuffer);
44
+ } else {
45
+ return sha256HashNode(data);
46
+ }
47
+ }
48
+ async function generateJWT(sub, aud, keyPair, expiresInSeconds = 24 * 60 * 60) {
49
+ const iat = Math.floor(Date.now() / 1e3);
50
+ const exp = iat + expiresInSeconds;
51
+ const header = { alg: "ES256", typ: "JWT" };
52
+ const payload = { sub, aud, iat, exp };
53
+ const encodedHeader = base64url(JSON.stringify(header));
54
+ const encodedPayload = base64url(JSON.stringify(payload));
55
+ const signingInput = `${encodedHeader}.${encodedPayload}`;
56
+ const hash = await hashInput(signingInput);
57
+ const signature = keyPair.sign(hash, { canonical: true });
58
+ const rBuf = signature.r.toArrayLike(Buffer, "be", 32);
59
+ const sBuf = signature.s.toArrayLike(Buffer, "be", 32);
60
+ const rawSig = Buffer.concat([rBuf, sBuf]);
61
+ const encodedSig = base64url(rawSig);
62
+ return `${signingInput}.${encodedSig}`;
63
+ }
64
+ async function createAuthEnvelope(privateKeyHex, network = "testnet" /* Testnet */, options) {
65
+ const keyPair = loadExistingSecp256k1PrivateKey(privateKeyHex);
66
+ const publicKey = serializePublicKeyCompressed(keyPair);
67
+ const host = NETWORK_HOSTS[network];
68
+ if (!host) {
69
+ throw new Error(`Unsupported network: ${network}`);
70
+ }
71
+ const token = await generateJWT(publicKey, host, keyPair, options?.expiresInSeconds);
72
+ return { publicKey, token };
73
+ }
74
+ async function generateAppSignature(privateKeyHex, clientId, redirectUri, state) {
75
+ const keyPair = loadExistingSecp256k1PrivateKey(privateKeyHex);
76
+ const message = `${clientId}:${redirectUri}:${state}`;
77
+ const hash = await hashInput(message);
78
+ const signatureDER = keyPair.sign(hash, { canonical: true }).toDER();
79
+ return Buffer.from(signatureDER).toString("hex");
80
+ }
81
+
82
+ export {
83
+ __require,
84
+ Network,
85
+ NETWORK_HOSTS,
86
+ loadExistingSecp256k1PrivateKey,
87
+ serializePublicKeyCompressed,
88
+ generateJWT,
89
+ createAuthEnvelope,
90
+ generateAppSignature
91
+ };
@@ -0,0 +1,93 @@
1
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
+ }) : x)(function(x) {
4
+ if (typeof require !== "undefined") return require.apply(this, arguments);
5
+ throw Error('Dynamic require of "' + x + '" is not supported');
6
+ });
7
+
8
+ // src/helpers/CryptoUtils.tsx
9
+ import { ec as EC } from "elliptic";
10
+ var ec = new EC("secp256k1");
11
+ var Network = /* @__PURE__ */ ((Network2) => {
12
+ Network2["Testnet"] = "testnet";
13
+ Network2["Localnet"] = "localnet";
14
+ return Network2;
15
+ })(Network || {});
16
+ var NETWORK_HOSTS = {
17
+ ["testnet" /* Testnet */]: "dev-db.petastic.com",
18
+ ["localnet" /* Localnet */]: "host.docker.internal:9181"
19
+ };
20
+ function loadExistingSecp256k1PrivateKey(hexKey) {
21
+ if (!hexKey) {
22
+ throw new Error("Private key hex must be provided");
23
+ }
24
+ return ec.keyFromPrivate(hexKey, "hex");
25
+ }
26
+ function serializePublicKeyCompressed(keyPair) {
27
+ return keyPair.getPublic(true, "hex");
28
+ }
29
+ function base64url(input) {
30
+ let buf;
31
+ if (typeof input === "string") buf = Buffer.from(input);
32
+ else if (input instanceof ArrayBuffer) buf = Buffer.from(input);
33
+ else buf = input;
34
+ return buf.toString("base64").replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
35
+ }
36
+ function sha256HashNode(data) {
37
+ const { createHash } = __require("crypto");
38
+ return createHash("sha256").update(data).digest();
39
+ }
40
+ async function hashInput(data) {
41
+ if (typeof window !== "undefined" && window.crypto?.subtle) {
42
+ const encoder = new TextEncoder();
43
+ const encoded = encoder.encode(data);
44
+ const hashBuffer = await window.crypto.subtle.digest("SHA-256", encoded);
45
+ return Buffer.from(hashBuffer);
46
+ } else {
47
+ return sha256HashNode(data);
48
+ }
49
+ }
50
+ async function generateJWT(sub, aud, keyPair, expiresInSeconds = 24 * 60 * 60) {
51
+ const iat = Math.floor(Date.now() / 1e3);
52
+ const exp = iat + expiresInSeconds;
53
+ const header = { alg: "ES256", typ: "JWT" };
54
+ const payload = { sub, aud, iat, exp };
55
+ const encodedHeader = base64url(JSON.stringify(header));
56
+ const encodedPayload = base64url(JSON.stringify(payload));
57
+ const signingInput = `${encodedHeader}.${encodedPayload}`;
58
+ const hash = await hashInput(signingInput);
59
+ const signature = keyPair.sign(hash, { canonical: true });
60
+ const rBuf = signature.r.toArrayLike(Buffer, "be", 32);
61
+ const sBuf = signature.s.toArrayLike(Buffer, "be", 32);
62
+ const rawSig = Buffer.concat([rBuf, sBuf]);
63
+ const encodedSig = base64url(rawSig);
64
+ return `${signingInput}.${encodedSig}`;
65
+ }
66
+ async function createAuthEnvelope(privateKeyHex, network = "testnet" /* Testnet */, options) {
67
+ const keyPair = loadExistingSecp256k1PrivateKey(privateKeyHex);
68
+ const publicKey = serializePublicKeyCompressed(keyPair);
69
+ const host = NETWORK_HOSTS[network];
70
+ if (!host) {
71
+ throw new Error(`Unsupported network: ${network}`);
72
+ }
73
+ const token = await generateJWT(publicKey, host, keyPair, options?.expiresInSeconds);
74
+ return { publicKey, token };
75
+ }
76
+ async function generateAppSignature(privateKeyHex, clientId, redirectUri, state) {
77
+ const keyPair = loadExistingSecp256k1PrivateKey(privateKeyHex);
78
+ const message = `${clientId}:${redirectUri}:${state}`;
79
+ const hash = await hashInput(message);
80
+ const signatureDER = keyPair.sign(hash, { canonical: true }).toDER();
81
+ return Buffer.from(signatureDER).toString("hex");
82
+ }
83
+
84
+ export {
85
+ __require,
86
+ Network,
87
+ NETWORK_HOSTS,
88
+ loadExistingSecp256k1PrivateKey,
89
+ serializePublicKeyCompressed,
90
+ generateJWT,
91
+ createAuthEnvelope,
92
+ generateAppSignature
93
+ };
@@ -0,0 +1,93 @@
1
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
+ }) : x)(function(x) {
4
+ if (typeof require !== "undefined") return require.apply(this, arguments);
5
+ throw Error('Dynamic require of "' + x + '" is not supported');
6
+ });
7
+
8
+ // src/helpers/CryptoUtils.tsx
9
+ import { ec as EC } from "elliptic";
10
+ var ec = new EC("secp256k1");
11
+ var Network = /* @__PURE__ */ ((Network2) => {
12
+ Network2["Testnet"] = "testnet";
13
+ Network2["Localnet"] = "localnet";
14
+ return Network2;
15
+ })(Network || {});
16
+ var NETWORK_HOSTS = {
17
+ ["testnet" /* Testnet */]: "https://dev-db.petastic.com",
18
+ ["localnet" /* Localnet */]: "host.docker.internal:9181"
19
+ };
20
+ function loadExistingSecp256k1PrivateKey(hexKey) {
21
+ if (!hexKey) {
22
+ throw new Error("Private key hex must be provided");
23
+ }
24
+ return ec.keyFromPrivate(hexKey, "hex");
25
+ }
26
+ function serializePublicKeyCompressed(keyPair) {
27
+ return keyPair.getPublic(true, "hex");
28
+ }
29
+ function base64url(input) {
30
+ let buf;
31
+ if (typeof input === "string") buf = Buffer.from(input);
32
+ else if (input instanceof ArrayBuffer) buf = Buffer.from(input);
33
+ else buf = input;
34
+ return buf.toString("base64").replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
35
+ }
36
+ function sha256HashNode(data) {
37
+ const { createHash } = __require("crypto");
38
+ return createHash("sha256").update(data).digest();
39
+ }
40
+ async function hashInput(data) {
41
+ if (typeof window !== "undefined" && window.crypto?.subtle) {
42
+ const encoder = new TextEncoder();
43
+ const encoded = encoder.encode(data);
44
+ const hashBuffer = await window.crypto.subtle.digest("SHA-256", encoded);
45
+ return Buffer.from(hashBuffer);
46
+ } else {
47
+ return sha256HashNode(data);
48
+ }
49
+ }
50
+ async function generateJWT(sub, aud, keyPair, expiresInSeconds = 24 * 60 * 60) {
51
+ const iat = Math.floor(Date.now() / 1e3);
52
+ const exp = iat + expiresInSeconds;
53
+ const header = { alg: "ES256", typ: "JWT" };
54
+ const payload = { sub, aud, iat, exp };
55
+ const encodedHeader = base64url(JSON.stringify(header));
56
+ const encodedPayload = base64url(JSON.stringify(payload));
57
+ const signingInput = `${encodedHeader}.${encodedPayload}`;
58
+ const hash = await hashInput(signingInput);
59
+ const signature = keyPair.sign(hash, { canonical: true });
60
+ const rBuf = signature.r.toArrayLike(Buffer, "be", 32);
61
+ const sBuf = signature.s.toArrayLike(Buffer, "be", 32);
62
+ const rawSig = Buffer.concat([rBuf, sBuf]);
63
+ const encodedSig = base64url(rawSig);
64
+ return `${signingInput}.${encodedSig}`;
65
+ }
66
+ async function createAuthEnvelope(privateKeyHex, network = "testnet" /* Testnet */, options) {
67
+ const keyPair = loadExistingSecp256k1PrivateKey(privateKeyHex);
68
+ const publicKey = serializePublicKeyCompressed(keyPair);
69
+ const host = NETWORK_HOSTS[network];
70
+ if (!host) {
71
+ throw new Error(`Unsupported network: ${network}`);
72
+ }
73
+ const token = await generateJWT(publicKey, host, keyPair, options?.expiresInSeconds);
74
+ return { publicKey, token };
75
+ }
76
+ async function generateAppSignature(privateKeyHex, clientId, redirectUri, state) {
77
+ const keyPair = loadExistingSecp256k1PrivateKey(privateKeyHex);
78
+ const message = `${clientId}:${redirectUri}:${state}`;
79
+ const hash = await hashInput(message);
80
+ const signatureDER = keyPair.sign(hash, { canonical: true }).toDER();
81
+ return Buffer.from(signatureDER).toString("hex");
82
+ }
83
+
84
+ export {
85
+ __require,
86
+ Network,
87
+ NETWORK_HOSTS,
88
+ loadExistingSecp256k1PrivateKey,
89
+ serializePublicKeyCompressed,
90
+ generateJWT,
91
+ createAuthEnvelope,
92
+ generateAppSignature
93
+ };
package/dist/index.js CHANGED
@@ -1266,6 +1266,44 @@ var ORGANIZATION_IMPL_ABI = [
1266
1266
 
1267
1267
  // src/utils/anymals/useMintAnymalNFT.ts
1268
1268
  var import_react10 = require("react");
1269
+
1270
+ // src/helpers/GasEstimateHelper.tsx
1271
+ function applyBundlerGasEstimator(account, bundlerClient, options) {
1272
+ const {
1273
+ callGasMultiplier = 1.2,
1274
+ verificationGasMultiplier = 1.2,
1275
+ preVerificationGasMultiplier = 2,
1276
+ debug = true
1277
+ } = options || {};
1278
+ account.userOperation = {
1279
+ estimateGas: async (userOp) => {
1280
+ const estimate = await bundlerClient.estimateUserOperationGas(userOp);
1281
+ const paddedCallGasLimit = BigInt(
1282
+ estimate.callGasLimit * BigInt(Math.ceil(callGasMultiplier * 100)) / 100n
1283
+ );
1284
+ const paddedVerificationGasLimit = BigInt(
1285
+ estimate.verificationGasLimit * BigInt(Math.ceil(verificationGasMultiplier * 100)) / 100n
1286
+ );
1287
+ const paddedPreVerificationGas = BigInt(
1288
+ estimate.preVerificationGas * BigInt(Math.ceil(preVerificationGasMultiplier * 100)) / 100n
1289
+ );
1290
+ if (debug) {
1291
+ console.log("\u{1F4E6} Bundler Gas Estimates:");
1292
+ console.log(" callGasLimit:", paddedCallGasLimit.toString());
1293
+ console.log(" verificationGasLimit:", paddedVerificationGasLimit.toString());
1294
+ console.log(" preVerificationGas:", paddedPreVerificationGas.toString());
1295
+ }
1296
+ return {
1297
+ ...estimate,
1298
+ callGasLimit: paddedCallGasLimit,
1299
+ verificationGasLimit: paddedVerificationGasLimit,
1300
+ preVerificationGas: paddedPreVerificationGas
1301
+ };
1302
+ }
1303
+ };
1304
+ }
1305
+
1306
+ // src/utils/anymals/useMintAnymalNFT.ts
1269
1307
  function useMintAnymalNFT() {
1270
1308
  return (0, import_react10.useCallback)(
1271
1309
  async (pid, nftId, anymalTxId, dbAuthToken, validationContractAddress, smartAccount, bundlerClient) => {
@@ -1286,6 +1324,7 @@ function useMintAnymalNFT() {
1286
1324
  anymalTxId
1287
1325
  ]
1288
1326
  });
1327
+ applyBundlerGasEstimator(smartAccount, bundlerClient);
1289
1328
  const userOpHash = await bundlerClient.sendUserOperation({
1290
1329
  account: smartAccount,
1291
1330
  calls: [
@@ -1294,7 +1333,7 @@ function useMintAnymalNFT() {
1294
1333
  data: callData
1295
1334
  }
1296
1335
  ],
1297
- maxPriorityFeePerGas: (0, import_viem.parseGwei)("0.003")
1336
+ paymaster: true
1298
1337
  });
1299
1338
  await bundlerClient.waitForUserOperationReceipt({
1300
1339
  hash: userOpHash,
@@ -1714,6 +1753,7 @@ function useProcessPartialKibblePayment() {
1714
1753
  functionName: "partialPay",
1715
1754
  args
1716
1755
  });
1756
+ applyBundlerGasEstimator(smartAccount, bundlerClient);
1717
1757
  const userOpHash = await bundlerClient.sendUserOperation({
1718
1758
  account: smartAccount,
1719
1759
  calls: [
@@ -1722,7 +1762,7 @@ function useProcessPartialKibblePayment() {
1722
1762
  data: callData
1723
1763
  }
1724
1764
  ],
1725
- maxPriorityFeePerGas: (0, import_viem2.parseGwei)("0.003")
1765
+ paymaster: true
1726
1766
  });
1727
1767
  const receipt = await bundlerClient.waitForUserOperationReceipt({
1728
1768
  hash: userOpHash,
@@ -1759,6 +1799,7 @@ function useApproveKibbleToken() {
1759
1799
  // amount to approve
1760
1800
  ]
1761
1801
  });
1802
+ applyBundlerGasEstimator(smartAccount, bundlerClient);
1762
1803
  const userOpHash = await bundlerClient.sendUserOperation({
1763
1804
  account: smartAccount,
1764
1805
  calls: [
@@ -1767,8 +1808,7 @@ function useApproveKibbleToken() {
1767
1808
  data: callData
1768
1809
  }
1769
1810
  ],
1770
- maxPriorityFeePerGas: (0, import_viem3.parseGwei)("0.003")
1771
- // maxFeePerGas: parseGwei("0.01"),
1811
+ paymaster: true
1772
1812
  });
1773
1813
  await bundlerClient.waitForUserOperationReceipt({
1774
1814
  hash: userOpHash,
@@ -1820,6 +1860,7 @@ function useCreateOrganizationBase() {
1820
1860
  functionName: "createOrganizationProxy",
1821
1861
  args: [ownerAddress, orgName, orgPid]
1822
1862
  });
1863
+ applyBundlerGasEstimator(adminSmartAccount, bundlerClient);
1823
1864
  const userOpHash = await bundlerClient.sendUserOperation({
1824
1865
  account: adminSmartAccount,
1825
1866
  calls: [
@@ -1828,9 +1869,7 @@ function useCreateOrganizationBase() {
1828
1869
  data: callData
1829
1870
  }
1830
1871
  ],
1831
- maxPriorityFeePerGas: (0, import_viem4.parseGwei)("0.003")
1832
- // Low priority fee
1833
- // maxFeePerGas: parseGwei("0.15"), // Max fee cap -- keeps rising at random
1872
+ paymaster: true
1834
1873
  });
1835
1874
  const txReceipt = await bundlerClient.waitForUserOperationReceipt({
1836
1875
  hash: userOpHash,
@@ -1873,7 +1912,7 @@ function useCreateOrganizationBase() {
1873
1912
  const errorMessage = error instanceof Error ? error.message : "An unknown error occurred.";
1874
1913
  return {
1875
1914
  success: false,
1876
- message: `Error processing organization: ${errorMessage}`
1915
+ message: `Error processing organization here: ${errorMessage}`
1877
1916
  };
1878
1917
  }
1879
1918
  },
@@ -1904,6 +1943,7 @@ function useApproveOrgPartialPayment() {
1904
1943
  functionName: "executeCall",
1905
1944
  args: [kibbleTokenAddress, approveCalldata]
1906
1945
  });
1946
+ applyBundlerGasEstimator(managerSmartAccount, bundlerClient);
1907
1947
  const userOpApproveHash = await bundlerClient.sendUserOperation({
1908
1948
  account: managerSmartAccount,
1909
1949
  calls: [
@@ -1912,8 +1952,7 @@ function useApproveOrgPartialPayment() {
1912
1952
  data: executeApproveCalldata
1913
1953
  }
1914
1954
  ],
1915
- maxPriorityFeePerGas: (0, import_viem5.parseGwei)("0.003")
1916
- // maxFeePerGas: parseGwei("0.01"),
1955
+ paymaster: true
1917
1956
  });
1918
1957
  await bundlerClient.waitForUserOperationReceipt({
1919
1958
  hash: userOpApproveHash
@@ -1963,6 +2002,7 @@ function useProcessOrgPartialKibblePayment() {
1963
2002
  functionName: "executeCall",
1964
2003
  args: [partialPaymentModuleAddress, partialPayCalldata]
1965
2004
  });
2005
+ applyBundlerGasEstimator(managerSmartAccount, bundlerClient);
1966
2006
  const userOpPartialPayHash = await bundlerClient.sendUserOperation({
1967
2007
  account: managerSmartAccount,
1968
2008
  calls: [
@@ -1971,8 +2011,7 @@ function useProcessOrgPartialKibblePayment() {
1971
2011
  data: executePartialPayCalldata
1972
2012
  }
1973
2013
  ],
1974
- maxPriorityFeePerGas: (0, import_viem6.parseGwei)("0.003")
1975
- // maxFeePerGas: parseGwei("0.01"),
2014
+ paymaster: true
1976
2015
  });
1977
2016
  const receipt = await bundlerClient.waitForUserOperationReceipt({
1978
2017
  hash: userOpPartialPayHash
@@ -2426,6 +2465,7 @@ function useClaimActionReward() {
2426
2465
  functionName: "claimByIndex",
2427
2466
  args: [actionId, claimIndex]
2428
2467
  });
2468
+ applyBundlerGasEstimator(smartAccount, bundlerClient);
2429
2469
  const userOpHash = await bundlerClient.sendUserOperation({
2430
2470
  account: smartAccount,
2431
2471
  calls: [
@@ -2434,7 +2474,7 @@ function useClaimActionReward() {
2434
2474
  data: callData
2435
2475
  }
2436
2476
  ],
2437
- maxPriorityFeePerGas: (0, import_viem9.parseGwei)("0.003")
2477
+ paymaster: true
2438
2478
  });
2439
2479
  await bundlerClient.waitForUserOperationReceipt({
2440
2480
  hash: userOpHash,
@@ -2469,6 +2509,7 @@ function useClaimOrgActionReward() {
2469
2509
  functionName: "executeCall",
2470
2510
  args: [rewardableActionContractAddress, claimCallData]
2471
2511
  });
2512
+ applyBundlerGasEstimator(smartAccount, bundlerClient);
2472
2513
  const userOpHash = await bundlerClient.sendUserOperation({
2473
2514
  account: smartAccount,
2474
2515
  calls: [
@@ -2477,7 +2518,7 @@ function useClaimOrgActionReward() {
2477
2518
  data: executeClaimCalldata
2478
2519
  }
2479
2520
  ],
2480
- maxPriorityFeePerGas: (0, import_viem10.parseGwei)("0.003")
2521
+ paymaster: true
2481
2522
  });
2482
2523
  await bundlerClient.waitForUserOperationReceipt({
2483
2524
  hash: userOpHash,
package/dist/index.mjs CHANGED
@@ -383,7 +383,7 @@ function useFetchNotifications() {
383
383
  }
384
384
 
385
385
  // src/utils/anymals/useMintAnymalNFT.ts
386
- import { encodeFunctionData, parseGwei } from "viem";
386
+ import { encodeFunctionData } from "viem";
387
387
 
388
388
  // src/helpers/BlockchainAbiHelper.tsx
389
389
  var PET_NFT_ABI = [{ "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, { "inputs": [], "name": "AccessControlBadConfirmation", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "account", "type": "address" }, { "internalType": "bytes32", "name": "neededRole", "type": "bytes32" }], "name": "AccessControlUnauthorizedAccount", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "target", "type": "address" }], "name": "AddressEmptyCode", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "implementation", "type": "address" }], "name": "ERC1967InvalidImplementation", "type": "error" }, { "inputs": [], "name": "ERC1967NonPayable", "type": "error" }, { "inputs": [], "name": "EnforcedPause", "type": "error" }, { "inputs": [], "name": "ExpectedPause", "type": "error" }, { "inputs": [], "name": "FailedCall", "type": "error" }, { "inputs": [], "name": "InvalidInitialization", "type": "error" }, { "inputs": [], "name": "NotInitializing", "type": "error" }, { "inputs": [], "name": "UUPSUnauthorizedCallContext", "type": "error" }, { "inputs": [{ "internalType": "bytes32", "name": "slot", "type": "bytes32" }], "name": "UUPSUnsupportedProxiableUUID", "type": "error" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "uint64", "name": "version", "type": "uint64" }], "name": "Initialized", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "user", "type": "address" }, { "indexed": false, "internalType": "string", "name": "pid", "type": "string" }, { "indexed": false, "internalType": "string", "name": "nftId", "type": "string" }, { "indexed": false, "internalType": "string", "name": "metadataURL", "type": "string" }, { "indexed": false, "internalType": "uint256", "name": "campaignId", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "rewardAmount", "type": "uint256" }, { "indexed": false, "internalType": "string", "name": "_anymalTxId", "type": "string" }], "name": "MetadataApproved", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "user", "type": "address" }, { "indexed": false, "internalType": "string", "name": "anymalTxId", "type": "string" }, { "indexed": false, "internalType": "string", "name": "pid", "type": "string" }, { "indexed": false, "internalType": "string", "name": "nftId", "type": "string" }, { "indexed": false, "internalType": "string", "name": "metadataURL", "type": "string" }, { "indexed": false, "internalType": "uint256", "name": "campaignId", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "rewardAmount", "type": "uint256" }, { "indexed": false, "internalType": "string", "name": "_anymalTxId", "type": "string" }], "name": "MetadataRejected", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "user", "type": "address" }, { "indexed": false, "internalType": "string", "name": "pid", "type": "string" }, { "indexed": false, "internalType": "string", "name": "nftId", "type": "string" }, { "indexed": false, "internalType": "string", "name": "metadataURL", "type": "string" }, { "indexed": false, "internalType": "uint256", "name": "campaignId", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "rewardAmount", "type": "uint256" }, { "indexed": false, "internalType": "string", "name": "_anymalTxId", "type": "string" }], "name": "MetadataSubmitted", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "address", "name": "account", "type": "address" }], "name": "Paused", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "user", "type": "address" }, { "indexed": false, "internalType": "string", "name": "pid", "type": "string" }, { "indexed": false, "internalType": "string", "name": "nftId", "type": "string" }, { "indexed": false, "internalType": "uint256", "name": "rewardAmount", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "campaignId", "type": "uint256" }, { "indexed": false, "internalType": "string", "name": "_anymalTxId", "type": "string" }], "name": "RewardDistributed", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "indexed": true, "internalType": "bytes32", "name": "previousAdminRole", "type": "bytes32" }, { "indexed": true, "internalType": "bytes32", "name": "newAdminRole", "type": "bytes32" }], "name": "RoleAdminChanged", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "indexed": true, "internalType": "address", "name": "account", "type": "address" }, { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }], "name": "RoleGranted", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "indexed": true, "internalType": "address", "name": "account", "type": "address" }, { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }], "name": "RoleRevoked", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "address", "name": "account", "type": "address" }], "name": "Unpaused", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "implementation", "type": "address" }], "name": "Upgraded", "type": "event" }, { "inputs": [], "name": "APPROVER_ROLE", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "DEFAULT_ADMIN_ROLE", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "UPGRADE_INTERFACE_VERSION", "outputs": [{ "internalType": "string", "name": "", "type": "string" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_user", "type": "address" }, { "internalType": "string", "name": "_pid", "type": "string" }, { "internalType": "string", "name": "_nftId", "type": "string" }, { "internalType": "string", "name": "_metadataURL", "type": "string" }, { "internalType": "uint256", "name": "_campaignId", "type": "uint256" }, { "internalType": "string", "name": "_anymalTxId", "type": "string" }], "name": "approveMetadata", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "campaignCount", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "name": "campaigns", "outputs": [{ "internalType": "string", "name": "name", "type": "string" }, { "internalType": "uint256", "name": "rewardAmount", "type": "uint256" }, { "internalType": "bool", "name": "isActive", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "string", "name": "_name", "type": "string" }, { "internalType": "uint256", "name": "_rewardAmount", "type": "uint256" }], "name": "createCampaign", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "defaultRewardAmount", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "role", "type": "bytes32" }], "name": "getRoleAdmin", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "internalType": "address", "name": "account", "type": "address" }], "name": "grantRole", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "internalType": "address", "name": "account", "type": "address" }], "name": "hasRole", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "initialOwner", "type": "address" }, { "internalType": "contract IERC20", "name": "_rewardToken", "type": "address" }, { "internalType": "contract IPetToken", "name": "_petToken", "type": "address" }, { "internalType": "uint256", "name": "_defaultRewardAmount", "type": "uint256" }], "name": "initialize", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "pause", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "paused", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "petToken", "outputs": [{ "internalType": "contract IPetToken", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "proxiableUUID", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "internalType": "address", "name": "callerConfirmation", "type": "address" }], "name": "renounceRole", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "internalType": "address", "name": "account", "type": "address" }], "name": "revokeRole", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "rewardToken", "outputs": [{ "internalType": "contract IERC20", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "string", "name": "_pid", "type": "string" }, { "internalType": "string", "name": "_nftId", "type": "string" }, { "internalType": "string", "name": "_metadataURL", "type": "string" }, { "internalType": "uint256", "name": "_campaignId", "type": "uint256" }, { "internalType": "string", "name": "_anymalTxId", "type": "string" }], "name": "submitMetadata", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "string", "name": "_pid", "type": "string" }, { "internalType": "string", "name": "_nftId", "type": "string" }, { "internalType": "string", "name": "_metadataURL", "type": "string" }, { "internalType": "string", "name": "_campaignName", "type": "string" }, { "internalType": "string", "name": "_anymalTxId", "type": "string" }], "name": "submitMetadataByCampaignName", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "bytes4", "name": "interfaceId", "type": "bytes4" }], "name": "supportsInterface", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "unpause", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "_campaignId", "type": "uint256" }, { "internalType": "uint256", "name": "_rewardAmount", "type": "uint256" }, { "internalType": "bool", "name": "_isActive", "type": "bool" }], "name": "updateCampaign", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "_rewardAmount", "type": "uint256" }], "name": "updateDefaultReward", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "newImplementation", "type": "address" }, { "internalType": "bytes", "name": "data", "type": "bytes" }], "name": "upgradeToAndCall", "outputs": [], "stateMutability": "payable", "type": "function" }];
@@ -1203,6 +1203,44 @@ var ORGANIZATION_IMPL_ABI = [
1203
1203
 
1204
1204
  // src/utils/anymals/useMintAnymalNFT.ts
1205
1205
  import { useCallback as useCallback10 } from "react";
1206
+
1207
+ // src/helpers/GasEstimateHelper.tsx
1208
+ function applyBundlerGasEstimator(account, bundlerClient, options) {
1209
+ const {
1210
+ callGasMultiplier = 1.2,
1211
+ verificationGasMultiplier = 1.2,
1212
+ preVerificationGasMultiplier = 2,
1213
+ debug = true
1214
+ } = options || {};
1215
+ account.userOperation = {
1216
+ estimateGas: async (userOp) => {
1217
+ const estimate = await bundlerClient.estimateUserOperationGas(userOp);
1218
+ const paddedCallGasLimit = BigInt(
1219
+ estimate.callGasLimit * BigInt(Math.ceil(callGasMultiplier * 100)) / 100n
1220
+ );
1221
+ const paddedVerificationGasLimit = BigInt(
1222
+ estimate.verificationGasLimit * BigInt(Math.ceil(verificationGasMultiplier * 100)) / 100n
1223
+ );
1224
+ const paddedPreVerificationGas = BigInt(
1225
+ estimate.preVerificationGas * BigInt(Math.ceil(preVerificationGasMultiplier * 100)) / 100n
1226
+ );
1227
+ if (debug) {
1228
+ console.log("\u{1F4E6} Bundler Gas Estimates:");
1229
+ console.log(" callGasLimit:", paddedCallGasLimit.toString());
1230
+ console.log(" verificationGasLimit:", paddedVerificationGasLimit.toString());
1231
+ console.log(" preVerificationGas:", paddedPreVerificationGas.toString());
1232
+ }
1233
+ return {
1234
+ ...estimate,
1235
+ callGasLimit: paddedCallGasLimit,
1236
+ verificationGasLimit: paddedVerificationGasLimit,
1237
+ preVerificationGas: paddedPreVerificationGas
1238
+ };
1239
+ }
1240
+ };
1241
+ }
1242
+
1243
+ // src/utils/anymals/useMintAnymalNFT.ts
1206
1244
  function useMintAnymalNFT() {
1207
1245
  return useCallback10(
1208
1246
  async (pid, nftId, anymalTxId, dbAuthToken, validationContractAddress, smartAccount, bundlerClient) => {
@@ -1223,6 +1261,7 @@ function useMintAnymalNFT() {
1223
1261
  anymalTxId
1224
1262
  ]
1225
1263
  });
1264
+ applyBundlerGasEstimator(smartAccount, bundlerClient);
1226
1265
  const userOpHash = await bundlerClient.sendUserOperation({
1227
1266
  account: smartAccount,
1228
1267
  calls: [
@@ -1231,7 +1270,7 @@ function useMintAnymalNFT() {
1231
1270
  data: callData
1232
1271
  }
1233
1272
  ],
1234
- maxPriorityFeePerGas: parseGwei("0.003")
1273
+ paymaster: true
1235
1274
  });
1236
1275
  await bundlerClient.waitForUserOperationReceipt({
1237
1276
  hash: userOpHash,
@@ -1616,7 +1655,7 @@ function useFetchAnymals() {
1616
1655
  }
1617
1656
 
1618
1657
  // src/utils/marketplace/useProcessPartialKibblePayment.ts
1619
- import { encodeFunctionData as encodeFunctionData2, parseGwei as parseGwei2 } from "viem";
1658
+ import { encodeFunctionData as encodeFunctionData2 } from "viem";
1620
1659
  import { useCallback as useCallback17 } from "react";
1621
1660
  function useProcessPartialKibblePayment() {
1622
1661
  return useCallback17(
@@ -1651,6 +1690,7 @@ function useProcessPartialKibblePayment() {
1651
1690
  functionName: "partialPay",
1652
1691
  args
1653
1692
  });
1693
+ applyBundlerGasEstimator(smartAccount, bundlerClient);
1654
1694
  const userOpHash = await bundlerClient.sendUserOperation({
1655
1695
  account: smartAccount,
1656
1696
  calls: [
@@ -1659,7 +1699,7 @@ function useProcessPartialKibblePayment() {
1659
1699
  data: callData
1660
1700
  }
1661
1701
  ],
1662
- maxPriorityFeePerGas: parseGwei2("0.003")
1702
+ paymaster: true
1663
1703
  });
1664
1704
  const receipt = await bundlerClient.waitForUserOperationReceipt({
1665
1705
  hash: userOpHash,
@@ -1680,7 +1720,7 @@ function useProcessPartialKibblePayment() {
1680
1720
  }
1681
1721
 
1682
1722
  // src/utils/marketplace/useApproveKibbleToken.ts
1683
- import { encodeFunctionData as encodeFunctionData3, erc20Abi, parseGwei as parseGwei3 } from "viem";
1723
+ import { encodeFunctionData as encodeFunctionData3, erc20Abi } from "viem";
1684
1724
  import { useCallback as useCallback18 } from "react";
1685
1725
  function useApproveKibbleToken() {
1686
1726
  return useCallback18(
@@ -1696,6 +1736,7 @@ function useApproveKibbleToken() {
1696
1736
  // amount to approve
1697
1737
  ]
1698
1738
  });
1739
+ applyBundlerGasEstimator(smartAccount, bundlerClient);
1699
1740
  const userOpHash = await bundlerClient.sendUserOperation({
1700
1741
  account: smartAccount,
1701
1742
  calls: [
@@ -1704,8 +1745,7 @@ function useApproveKibbleToken() {
1704
1745
  data: callData
1705
1746
  }
1706
1747
  ],
1707
- maxPriorityFeePerGas: parseGwei3("0.003")
1708
- // maxFeePerGas: parseGwei("0.01"),
1748
+ paymaster: true
1709
1749
  });
1710
1750
  await bundlerClient.waitForUserOperationReceipt({
1711
1751
  hash: userOpHash,
@@ -1730,7 +1770,7 @@ function useApproveKibbleToken() {
1730
1770
 
1731
1771
  // src/utils/organization/useCreateOrganizationBase.ts
1732
1772
  import { useCallback as useCallback19 } from "react";
1733
- import { decodeEventLog, encodeFunctionData as encodeFunctionData4, parseGwei as parseGwei4 } from "viem";
1773
+ import { decodeEventLog, encodeFunctionData as encodeFunctionData4 } from "viem";
1734
1774
  function useCreateOrganizationBase() {
1735
1775
  return useCallback19(
1736
1776
  /**
@@ -1757,6 +1797,7 @@ function useCreateOrganizationBase() {
1757
1797
  functionName: "createOrganizationProxy",
1758
1798
  args: [ownerAddress, orgName, orgPid]
1759
1799
  });
1800
+ applyBundlerGasEstimator(adminSmartAccount, bundlerClient);
1760
1801
  const userOpHash = await bundlerClient.sendUserOperation({
1761
1802
  account: adminSmartAccount,
1762
1803
  calls: [
@@ -1765,9 +1806,7 @@ function useCreateOrganizationBase() {
1765
1806
  data: callData
1766
1807
  }
1767
1808
  ],
1768
- maxPriorityFeePerGas: parseGwei4("0.003")
1769
- // Low priority fee
1770
- // maxFeePerGas: parseGwei("0.15"), // Max fee cap -- keeps rising at random
1809
+ paymaster: true
1771
1810
  });
1772
1811
  const txReceipt = await bundlerClient.waitForUserOperationReceipt({
1773
1812
  hash: userOpHash,
@@ -1810,7 +1849,7 @@ function useCreateOrganizationBase() {
1810
1849
  const errorMessage = error instanceof Error ? error.message : "An unknown error occurred.";
1811
1850
  return {
1812
1851
  success: false,
1813
- message: `Error processing organization: ${errorMessage}`
1852
+ message: `Error processing organization here: ${errorMessage}`
1814
1853
  };
1815
1854
  }
1816
1855
  },
@@ -1820,7 +1859,7 @@ function useCreateOrganizationBase() {
1820
1859
 
1821
1860
  // src/utils/organization/useApproveOrgKibbleToken.ts
1822
1861
  import { useCallback as useCallback20 } from "react";
1823
- import { encodeFunctionData as encodeFunctionData5, erc20Abi as erc20Abi2, parseGwei as parseGwei5 } from "viem";
1862
+ import { encodeFunctionData as encodeFunctionData5, erc20Abi as erc20Abi2 } from "viem";
1824
1863
  function useApproveOrgPartialPayment() {
1825
1864
  return useCallback20(
1826
1865
  async (orgContractAddress, kibbleTokenAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, approveAmount) => {
@@ -1841,6 +1880,7 @@ function useApproveOrgPartialPayment() {
1841
1880
  functionName: "executeCall",
1842
1881
  args: [kibbleTokenAddress, approveCalldata]
1843
1882
  });
1883
+ applyBundlerGasEstimator(managerSmartAccount, bundlerClient);
1844
1884
  const userOpApproveHash = await bundlerClient.sendUserOperation({
1845
1885
  account: managerSmartAccount,
1846
1886
  calls: [
@@ -1849,8 +1889,7 @@ function useApproveOrgPartialPayment() {
1849
1889
  data: executeApproveCalldata
1850
1890
  }
1851
1891
  ],
1852
- maxPriorityFeePerGas: parseGwei5("0.003")
1853
- // maxFeePerGas: parseGwei("0.01"),
1892
+ paymaster: true
1854
1893
  });
1855
1894
  await bundlerClient.waitForUserOperationReceipt({
1856
1895
  hash: userOpApproveHash
@@ -1870,7 +1909,7 @@ function useApproveOrgPartialPayment() {
1870
1909
 
1871
1910
  // src/utils/organization/useProcessOrgPartialKibblePayment.ts
1872
1911
  import { useCallback as useCallback21 } from "react";
1873
- import { encodeFunctionData as encodeFunctionData6, parseGwei as parseGwei6 } from "viem";
1912
+ import { encodeFunctionData as encodeFunctionData6 } from "viem";
1874
1913
  function useProcessOrgPartialKibblePayment() {
1875
1914
  return useCallback21(
1876
1915
  async (orgContractAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, orderId, anymalNftId, pid, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) => {
@@ -1900,6 +1939,7 @@ function useProcessOrgPartialKibblePayment() {
1900
1939
  functionName: "executeCall",
1901
1940
  args: [partialPaymentModuleAddress, partialPayCalldata]
1902
1941
  });
1942
+ applyBundlerGasEstimator(managerSmartAccount, bundlerClient);
1903
1943
  const userOpPartialPayHash = await bundlerClient.sendUserOperation({
1904
1944
  account: managerSmartAccount,
1905
1945
  calls: [
@@ -1908,8 +1948,7 @@ function useProcessOrgPartialKibblePayment() {
1908
1948
  data: executePartialPayCalldata
1909
1949
  }
1910
1950
  ],
1911
- maxPriorityFeePerGas: parseGwei6("0.003")
1912
- // maxFeePerGas: parseGwei("0.01"),
1951
+ paymaster: true
1913
1952
  });
1914
1953
  const receipt = await bundlerClient.waitForUserOperationReceipt({
1915
1954
  hash: userOpPartialPayHash
@@ -2267,7 +2306,7 @@ function useFetchBalance() {
2267
2306
  }
2268
2307
 
2269
2308
  // src/utils/actions/useClaimActionReward.ts
2270
- import { encodeFunctionData as encodeFunctionData7, parseGwei as parseGwei7 } from "viem";
2309
+ import { encodeFunctionData as encodeFunctionData7 } from "viem";
2271
2310
  import { useCallback as useCallback28 } from "react";
2272
2311
  function useClaimActionReward() {
2273
2312
  return useCallback28(
@@ -2283,6 +2322,7 @@ function useClaimActionReward() {
2283
2322
  functionName: "claimByIndex",
2284
2323
  args: [actionId, claimIndex]
2285
2324
  });
2325
+ applyBundlerGasEstimator(smartAccount, bundlerClient);
2286
2326
  const userOpHash = await bundlerClient.sendUserOperation({
2287
2327
  account: smartAccount,
2288
2328
  calls: [
@@ -2291,7 +2331,7 @@ function useClaimActionReward() {
2291
2331
  data: callData
2292
2332
  }
2293
2333
  ],
2294
- maxPriorityFeePerGas: parseGwei7("0.003")
2334
+ paymaster: true
2295
2335
  });
2296
2336
  await bundlerClient.waitForUserOperationReceipt({
2297
2337
  hash: userOpHash,
@@ -2305,7 +2345,7 @@ function useClaimActionReward() {
2305
2345
  }
2306
2346
 
2307
2347
  // src/utils/actions/useClaimOrgActionReward.ts
2308
- import { encodeFunctionData as encodeFunctionData8, parseGwei as parseGwei8 } from "viem";
2348
+ import { encodeFunctionData as encodeFunctionData8 } from "viem";
2309
2349
  import { useCallback as useCallback29 } from "react";
2310
2350
  function useClaimOrgActionReward() {
2311
2351
  return useCallback29(
@@ -2326,6 +2366,7 @@ function useClaimOrgActionReward() {
2326
2366
  functionName: "executeCall",
2327
2367
  args: [rewardableActionContractAddress, claimCallData]
2328
2368
  });
2369
+ applyBundlerGasEstimator(smartAccount, bundlerClient);
2329
2370
  const userOpHash = await bundlerClient.sendUserOperation({
2330
2371
  account: smartAccount,
2331
2372
  calls: [
@@ -2334,7 +2375,7 @@ function useClaimOrgActionReward() {
2334
2375
  data: executeClaimCalldata
2335
2376
  }
2336
2377
  ],
2337
- maxPriorityFeePerGas: parseGwei8("0.003")
2378
+ paymaster: true
2338
2379
  });
2339
2380
  await bundlerClient.waitForUserOperationReceipt({
2340
2381
  hash: userOpHash,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anymal-protocol",
3
- "version": "1.0.114",
3
+ "version": "1.0.116",
4
4
  "description": "A React/TypeScript-based utility library for reusable functions and hooks inside of the Anymal Ecosystem.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {