anymal-protocol 1.0.135 → 1.0.137
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.d.mts +5 -9
- package/dist/index.d.ts +5 -9
- package/dist/index.js +44 -94
- package/dist/index.mjs +10 -60
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -428,15 +428,11 @@ declare const ORG_FUNCTION = "executeCall";
|
|
|
428
428
|
*
|
|
429
429
|
* @returns {Function} - Async function to create the organization.
|
|
430
430
|
*/
|
|
431
|
-
declare function useCoinbaseCreateOrganizationWallet(): {
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
status: string;
|
|
437
|
-
}>;
|
|
438
|
-
status: _coinbase_cdp_hooks.Status;
|
|
439
|
-
};
|
|
431
|
+
declare function useCoinbaseCreateOrganizationWallet(): (orgPid: string, orgName: string, ownerAddress: string, orgContractAddress: `0x${string}`, evmAddress: `0x${string}`) => Promise<{
|
|
432
|
+
success: boolean;
|
|
433
|
+
message: string;
|
|
434
|
+
status: string;
|
|
435
|
+
}>;
|
|
440
436
|
|
|
441
437
|
declare function useMintAnymalNFT(): (pid: string, nftId: string, anymalTxId: string, dbAuthToken: string, validationContractAddress: string, smartAccount: any, bundlerClient: any) => Promise<{
|
|
442
438
|
success: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -428,15 +428,11 @@ declare const ORG_FUNCTION = "executeCall";
|
|
|
428
428
|
*
|
|
429
429
|
* @returns {Function} - Async function to create the organization.
|
|
430
430
|
*/
|
|
431
|
-
declare function useCoinbaseCreateOrganizationWallet(): {
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
status: string;
|
|
437
|
-
}>;
|
|
438
|
-
status: _coinbase_cdp_hooks.Status;
|
|
439
|
-
};
|
|
431
|
+
declare function useCoinbaseCreateOrganizationWallet(): (orgPid: string, orgName: string, ownerAddress: string, orgContractAddress: `0x${string}`, evmAddress: `0x${string}`) => Promise<{
|
|
432
|
+
success: boolean;
|
|
433
|
+
message: string;
|
|
434
|
+
status: string;
|
|
435
|
+
}>;
|
|
440
436
|
|
|
441
437
|
declare function useMintAnymalNFT(): (pid: string, nftId: string, anymalTxId: string, dbAuthToken: string, validationContractAddress: string, smartAccount: any, bundlerClient: any) => Promise<{
|
|
442
438
|
success: boolean;
|
package/dist/index.js
CHANGED
|
@@ -3013,27 +3013,18 @@ function useCoinbaseMintAnymalNFT() {
|
|
|
3013
3013
|
|
|
3014
3014
|
// src/utils/coinbase/useCoinbaseCreateOrganizationWallet.ts
|
|
3015
3015
|
var import_react13 = require("react");
|
|
3016
|
-
var import_viem3 = require("viem");
|
|
3017
|
-
var import_chains2 = require("viem/chains");
|
|
3018
3016
|
function useCoinbaseCreateOrganizationWallet() {
|
|
3019
|
-
const { sendOperationFn,
|
|
3020
|
-
|
|
3021
|
-
() => (0, import_viem3.createPublicClient)({
|
|
3022
|
-
chain: import_chains2.baseSepolia,
|
|
3023
|
-
transport: (0, import_viem3.http)()
|
|
3024
|
-
}),
|
|
3025
|
-
[]
|
|
3026
|
-
);
|
|
3027
|
-
const createOrganization = (0, import_react13.useCallback)(
|
|
3017
|
+
const { sendOperationFn, status } = useSendCoinbaseUserOperation();
|
|
3018
|
+
return (0, import_react13.useCallback)(
|
|
3028
3019
|
/**
|
|
3029
3020
|
* Creates a new organization on-chain.
|
|
3030
3021
|
*
|
|
3031
|
-
* @param orgPid - The PID of the organization as registered in
|
|
3032
|
-
* @param orgName - The name of the organization as registered in
|
|
3022
|
+
* @param orgPid - The PID of the organization as registered in Firestore.
|
|
3023
|
+
* @param orgName - The name of the organization as registered in Firestore.
|
|
3033
3024
|
* @param ownerAddress - The wallet address of the user who will be the default manager.
|
|
3034
3025
|
* @param orgContractAddress - The contract address of the organization beacon.
|
|
3035
3026
|
* @param evmAddress - The Coinbase smart account address of the admin.
|
|
3036
|
-
* @returns A promise with success status, message, and
|
|
3027
|
+
* @returns A promise with success status, message, and status.
|
|
3037
3028
|
*/
|
|
3038
3029
|
async (orgPid, orgName, ownerAddress, orgContractAddress, evmAddress) => {
|
|
3039
3030
|
if (!orgPid || !orgName || !ownerAddress || !orgContractAddress || !evmAddress) {
|
|
@@ -3050,55 +3041,14 @@ function useCoinbaseCreateOrganizationWallet() {
|
|
|
3050
3041
|
"createOrganizationProxy",
|
|
3051
3042
|
[ownerAddress, orgName, orgPid]
|
|
3052
3043
|
);
|
|
3053
|
-
|
|
3054
|
-
return { ...result, status: "error" };
|
|
3055
|
-
}
|
|
3056
|
-
let proxyAddress;
|
|
3057
|
-
try {
|
|
3058
|
-
const txHash = data?.receipts?.[0]?.transactionHash || data?.transactionHash;
|
|
3059
|
-
if (txHash) {
|
|
3060
|
-
const receipt = await publicClient.getTransactionReceipt({
|
|
3061
|
-
hash: txHash
|
|
3062
|
-
});
|
|
3063
|
-
for (const log of receipt.logs) {
|
|
3064
|
-
try {
|
|
3065
|
-
const decoded = (0, import_viem3.decodeEventLog)({
|
|
3066
|
-
abi: ORGANIZATION_BEACON_ABI,
|
|
3067
|
-
data: log.data,
|
|
3068
|
-
topics: log.topics
|
|
3069
|
-
});
|
|
3070
|
-
if (decoded.eventName === "NewOrganizationCreated") {
|
|
3071
|
-
proxyAddress = decoded.args.proxyAddress;
|
|
3072
|
-
break;
|
|
3073
|
-
}
|
|
3074
|
-
} catch {
|
|
3075
|
-
}
|
|
3076
|
-
}
|
|
3077
|
-
}
|
|
3078
|
-
} catch (e) {
|
|
3079
|
-
console.error("Failed to get transaction receipt:", e);
|
|
3080
|
-
}
|
|
3081
|
-
if (!proxyAddress) {
|
|
3082
|
-
return {
|
|
3083
|
-
success: true,
|
|
3084
|
-
message: "Organization registered successfully, but proxy address not found in logs.",
|
|
3085
|
-
status
|
|
3086
|
-
};
|
|
3087
|
-
}
|
|
3088
|
-
return {
|
|
3089
|
-
success: true,
|
|
3090
|
-
message: "Organization registered successfully.",
|
|
3091
|
-
proxyAddress,
|
|
3092
|
-
status
|
|
3093
|
-
};
|
|
3044
|
+
return { ...result, status };
|
|
3094
3045
|
},
|
|
3095
|
-
[sendOperationFn,
|
|
3046
|
+
[sendOperationFn, status]
|
|
3096
3047
|
);
|
|
3097
|
-
return { createOrganization, status };
|
|
3098
3048
|
}
|
|
3099
3049
|
|
|
3100
3050
|
// src/utils/anymals/useMintAnymalNFT.ts
|
|
3101
|
-
var
|
|
3051
|
+
var import_viem4 = require("viem");
|
|
3102
3052
|
var import_react14 = require("react");
|
|
3103
3053
|
|
|
3104
3054
|
// src/helpers/GasEstimateHelper.tsx
|
|
@@ -3143,18 +3093,18 @@ async function applyBundlerGasEstimator(account, bundlerClient, options) {
|
|
|
3143
3093
|
}
|
|
3144
3094
|
|
|
3145
3095
|
// src/helpers/HumanRevert.tsx
|
|
3146
|
-
var
|
|
3096
|
+
var import_viem3 = require("viem");
|
|
3147
3097
|
function humanRevert(raw, shortMessage) {
|
|
3148
3098
|
if (!raw) return shortMessage ?? "Simulation reverted";
|
|
3149
3099
|
try {
|
|
3150
|
-
const { errorName, args } = (0,
|
|
3100
|
+
const { errorName, args } = (0, import_viem3.decodeErrorResult)({
|
|
3151
3101
|
abi: ERROR_ABI,
|
|
3152
3102
|
data: raw
|
|
3153
3103
|
});
|
|
3154
3104
|
return `${errorName}(${args.map(String).join(", ")})`;
|
|
3155
3105
|
} catch {
|
|
3156
3106
|
if (raw.startsWith("0x08c379a0") && raw.length >= 138) {
|
|
3157
|
-
return (0,
|
|
3107
|
+
return (0, import_viem3.hexToString)(`0x${raw.slice(138)}`);
|
|
3158
3108
|
}
|
|
3159
3109
|
return `${raw.slice(0, 10)}\u2026`;
|
|
3160
3110
|
}
|
|
@@ -3196,7 +3146,7 @@ function useMintAnymalNFT() {
|
|
|
3196
3146
|
"petastic-signup-campaign-1",
|
|
3197
3147
|
anymalTxId
|
|
3198
3148
|
];
|
|
3199
|
-
const callData = (0,
|
|
3149
|
+
const callData = (0, import_viem4.encodeFunctionData)({
|
|
3200
3150
|
abi: PET_NFT_ABI,
|
|
3201
3151
|
functionName,
|
|
3202
3152
|
args
|
|
@@ -3383,7 +3333,7 @@ function useUploadAnymalImage() {
|
|
|
3383
3333
|
var import_react17 = require("react");
|
|
3384
3334
|
|
|
3385
3335
|
// src/helpers/ProcessDirectPartialPayment.tsx
|
|
3386
|
-
var
|
|
3336
|
+
var import_viem5 = require("viem");
|
|
3387
3337
|
|
|
3388
3338
|
// src/helpers/SendUserOpWithRetries.tsx
|
|
3389
3339
|
async function sendUserOpWithRetries(bundlerClient, params, retries = 3, delay = 1e3) {
|
|
@@ -3443,7 +3393,7 @@ async function processDirectPartialPayment(marketplaceContract, smartAccount, bu
|
|
|
3443
3393
|
deadline,
|
|
3444
3394
|
backendSignature
|
|
3445
3395
|
];
|
|
3446
|
-
const partialPayCalldata = (0,
|
|
3396
|
+
const partialPayCalldata = (0, import_viem5.encodeFunctionData)({
|
|
3447
3397
|
abi: MARKETPLACE_ABI,
|
|
3448
3398
|
functionName,
|
|
3449
3399
|
args
|
|
@@ -3539,20 +3489,20 @@ function useProcessPartialKibblePayment() {
|
|
|
3539
3489
|
var import_react18 = require("react");
|
|
3540
3490
|
|
|
3541
3491
|
// src/helpers/ProcessDirectKibbleApproval.tsx
|
|
3542
|
-
var
|
|
3492
|
+
var import_viem6 = require("viem");
|
|
3543
3493
|
async function processDirectKibbleApproval(kibbleTokenAddress, spenderAddress, smartAccount, bundlerClient, approveAmount) {
|
|
3544
3494
|
try {
|
|
3545
3495
|
const functionName = "approve";
|
|
3546
3496
|
const args = [spenderAddress, approveAmount];
|
|
3547
|
-
const approveCalldata = (0,
|
|
3548
|
-
abi:
|
|
3497
|
+
const approveCalldata = (0, import_viem6.encodeFunctionData)({
|
|
3498
|
+
abi: import_viem6.erc20Abi,
|
|
3549
3499
|
functionName,
|
|
3550
3500
|
args
|
|
3551
3501
|
});
|
|
3552
3502
|
await simulateCall(
|
|
3553
3503
|
bundlerClient.client,
|
|
3554
3504
|
kibbleTokenAddress,
|
|
3555
|
-
|
|
3505
|
+
import_viem6.erc20Abi,
|
|
3556
3506
|
functionName,
|
|
3557
3507
|
args,
|
|
3558
3508
|
smartAccount.address
|
|
@@ -3609,7 +3559,7 @@ function useApproveKibbleToken() {
|
|
|
3609
3559
|
|
|
3610
3560
|
// src/utils/organization/useCreateOrganizationBase.ts
|
|
3611
3561
|
var import_react19 = require("react");
|
|
3612
|
-
var
|
|
3562
|
+
var import_viem7 = require("viem");
|
|
3613
3563
|
function useCreateOrganizationBase() {
|
|
3614
3564
|
return (0, import_react19.useCallback)(
|
|
3615
3565
|
/**
|
|
@@ -3633,7 +3583,7 @@ function useCreateOrganizationBase() {
|
|
|
3633
3583
|
try {
|
|
3634
3584
|
const functionName = "createOrganizationProxy";
|
|
3635
3585
|
const args = [ownerAddress, orgName, orgPid];
|
|
3636
|
-
const callData = (0,
|
|
3586
|
+
const callData = (0, import_viem7.encodeFunctionData)({
|
|
3637
3587
|
abi: ORGANIZATION_BEACON_ABI,
|
|
3638
3588
|
functionName,
|
|
3639
3589
|
args
|
|
@@ -3671,7 +3621,7 @@ function useCreateOrganizationBase() {
|
|
|
3671
3621
|
let proxyAddress;
|
|
3672
3622
|
for (const log of txReceipt.logs) {
|
|
3673
3623
|
try {
|
|
3674
|
-
const decoded = (0,
|
|
3624
|
+
const decoded = (0, import_viem7.decodeEventLog)({
|
|
3675
3625
|
abi: ORGANIZATION_BEACON_ABI,
|
|
3676
3626
|
data: log.data,
|
|
3677
3627
|
topics: log.topics
|
|
@@ -3710,10 +3660,10 @@ function useCreateOrganizationBase() {
|
|
|
3710
3660
|
var import_react20 = require("react");
|
|
3711
3661
|
|
|
3712
3662
|
// src/helpers/ProcessOrgKibbleApproval.tsx
|
|
3713
|
-
var
|
|
3663
|
+
var import_viem9 = require("viem");
|
|
3714
3664
|
|
|
3715
3665
|
// src/helpers/WaitForAllowance.tsx
|
|
3716
|
-
var
|
|
3666
|
+
var import_viem8 = require("viem");
|
|
3717
3667
|
async function waitForAllowance(publicClient, tokenAddress, ownerAddress, spenderAddress, expectedAmount) {
|
|
3718
3668
|
const MAX_RETRIES = 10;
|
|
3719
3669
|
const RETRY_INTERVAL = 2e3;
|
|
@@ -3722,7 +3672,7 @@ async function waitForAllowance(publicClient, tokenAddress, ownerAddress, spende
|
|
|
3722
3672
|
try {
|
|
3723
3673
|
const currentAllowance = await publicClient.readContract({
|
|
3724
3674
|
address: tokenAddress,
|
|
3725
|
-
abi:
|
|
3675
|
+
abi: import_viem8.erc20Abi,
|
|
3726
3676
|
functionName: "allowance",
|
|
3727
3677
|
args: [ownerAddress, spenderAddress]
|
|
3728
3678
|
});
|
|
@@ -3747,13 +3697,13 @@ async function processOrgKibbleApproval(orgContractAddress, kibbleTokenAddress,
|
|
|
3747
3697
|
if (approveAmount <= 0n) {
|
|
3748
3698
|
return { success: false, message: "Approval amount must be greater than zero." };
|
|
3749
3699
|
}
|
|
3750
|
-
const approveCalldata = (0,
|
|
3751
|
-
abi:
|
|
3700
|
+
const approveCalldata = (0, import_viem9.encodeFunctionData)({
|
|
3701
|
+
abi: import_viem9.erc20Abi,
|
|
3752
3702
|
functionName: "approve",
|
|
3753
3703
|
args: [partialPaymentModuleAddress, approveAmount]
|
|
3754
3704
|
});
|
|
3755
3705
|
const args = [kibbleTokenAddress, approveCalldata];
|
|
3756
|
-
const executeApproveCalldata = (0,
|
|
3706
|
+
const executeApproveCalldata = (0, import_viem9.encodeFunctionData)({
|
|
3757
3707
|
abi: ORGANIZATION_IMPL_ABI,
|
|
3758
3708
|
functionName: ORG_FUNCTION,
|
|
3759
3709
|
args
|
|
@@ -3840,10 +3790,10 @@ function useApproveOrgPartialPayment() {
|
|
|
3840
3790
|
var import_react21 = require("react");
|
|
3841
3791
|
|
|
3842
3792
|
// src/helpers/ProcessOrgPartialPayment.tsx
|
|
3843
|
-
var
|
|
3793
|
+
var import_viem10 = require("viem");
|
|
3844
3794
|
async function processOrgPartialPayment(orgContractAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, orderId, anymalNftId, pid, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) {
|
|
3845
3795
|
try {
|
|
3846
|
-
const partialPayCalldata = (0,
|
|
3796
|
+
const partialPayCalldata = (0, import_viem10.encodeFunctionData)({
|
|
3847
3797
|
abi: MARKETPLACE_ABI,
|
|
3848
3798
|
functionName: "partialPay",
|
|
3849
3799
|
args: [
|
|
@@ -3858,7 +3808,7 @@ async function processOrgPartialPayment(orgContractAddress, partialPaymentModule
|
|
|
3858
3808
|
]
|
|
3859
3809
|
});
|
|
3860
3810
|
const args = [partialPaymentModuleAddress, partialPayCalldata];
|
|
3861
|
-
const executePartialPayCalldata = (0,
|
|
3811
|
+
const executePartialPayCalldata = (0, import_viem10.encodeFunctionData)({
|
|
3862
3812
|
abi: ORGANIZATION_IMPL_ABI,
|
|
3863
3813
|
functionName: ORG_FUNCTION,
|
|
3864
3814
|
args
|
|
@@ -3974,7 +3924,7 @@ function useUpdateOrgWalletAddress() {
|
|
|
3974
3924
|
}
|
|
3975
3925
|
|
|
3976
3926
|
// src/utils/organization/useMintOrgAnymalNFT.ts
|
|
3977
|
-
var
|
|
3927
|
+
var import_viem11 = require("viem");
|
|
3978
3928
|
var import_react23 = require("react");
|
|
3979
3929
|
function useMintOrgAnymalNFT() {
|
|
3980
3930
|
return (0, import_react23.useCallback)(
|
|
@@ -3993,13 +3943,13 @@ function useMintOrgAnymalNFT() {
|
|
|
3993
3943
|
"petastic-signup-campaign-1",
|
|
3994
3944
|
anymalTxId
|
|
3995
3945
|
];
|
|
3996
|
-
const callData = (0,
|
|
3946
|
+
const callData = (0, import_viem11.encodeFunctionData)({
|
|
3997
3947
|
abi: PET_NFT_ABI,
|
|
3998
3948
|
functionName,
|
|
3999
3949
|
args
|
|
4000
3950
|
});
|
|
4001
3951
|
const executeArgs = [validationContractAddress, callData];
|
|
4002
|
-
const executeSubmitMetaCalldata = (0,
|
|
3952
|
+
const executeSubmitMetaCalldata = (0, import_viem11.encodeFunctionData)({
|
|
4003
3953
|
abi: ORGANIZATION_IMPL_ABI,
|
|
4004
3954
|
functionName: ORG_FUNCTION,
|
|
4005
3955
|
args: executeArgs
|
|
@@ -4032,10 +3982,10 @@ function useMintOrgAnymalNFT() {
|
|
|
4032
3982
|
|
|
4033
3983
|
// src/helpers/NonceHelper.tsx
|
|
4034
3984
|
var import_uuid = require("uuid");
|
|
4035
|
-
var
|
|
3985
|
+
var import_viem12 = require("viem");
|
|
4036
3986
|
var generateBytes32Nonce = () => {
|
|
4037
3987
|
const uuid3 = (0, import_uuid.v4)().replace(/-/g, "");
|
|
4038
|
-
return (0,
|
|
3988
|
+
return (0, import_viem12.padHex)(`0x${uuid3}`, { size: 32 });
|
|
4039
3989
|
};
|
|
4040
3990
|
|
|
4041
3991
|
// src/helpers/CryptoUtils.tsx
|
|
@@ -4491,16 +4441,16 @@ function useCreateOrganizationAppData() {
|
|
|
4491
4441
|
|
|
4492
4442
|
// src/utils/balance/useFetchBalance.ts
|
|
4493
4443
|
var import_react28 = require("react");
|
|
4494
|
-
var
|
|
4444
|
+
var import_viem13 = require("viem");
|
|
4495
4445
|
function useFetchBalance() {
|
|
4496
4446
|
return (0, import_react28.useCallback)(
|
|
4497
4447
|
async (publicClient, walletAddress, kibbleTokenAddress) => {
|
|
4498
4448
|
try {
|
|
4499
4449
|
const balance = await publicClient.readContract({
|
|
4500
|
-
address: (0,
|
|
4501
|
-
abi:
|
|
4450
|
+
address: (0, import_viem13.getAddress)(kibbleTokenAddress),
|
|
4451
|
+
abi: import_viem13.erc20Abi,
|
|
4502
4452
|
functionName: "balanceOf",
|
|
4503
|
-
args: [(0,
|
|
4453
|
+
args: [(0, import_viem13.getAddress)(walletAddress)]
|
|
4504
4454
|
});
|
|
4505
4455
|
return Number(balance);
|
|
4506
4456
|
} catch (error) {
|
|
@@ -4512,7 +4462,7 @@ function useFetchBalance() {
|
|
|
4512
4462
|
}
|
|
4513
4463
|
|
|
4514
4464
|
// src/utils/actions/useClaimActionReward.ts
|
|
4515
|
-
var
|
|
4465
|
+
var import_viem14 = require("viem");
|
|
4516
4466
|
var import_react29 = require("react");
|
|
4517
4467
|
function useClaimActionReward() {
|
|
4518
4468
|
return (0, import_react29.useCallback)(
|
|
@@ -4525,7 +4475,7 @@ function useClaimActionReward() {
|
|
|
4525
4475
|
}
|
|
4526
4476
|
const args = [actionId, claimIndex];
|
|
4527
4477
|
const functionName = "claimByIndex";
|
|
4528
|
-
const callData = (0,
|
|
4478
|
+
const callData = (0, import_viem14.encodeFunctionData)({
|
|
4529
4479
|
abi: REWARDABLE_ACTIONS_ABI,
|
|
4530
4480
|
functionName,
|
|
4531
4481
|
args
|
|
@@ -4561,7 +4511,7 @@ function useClaimActionReward() {
|
|
|
4561
4511
|
}
|
|
4562
4512
|
|
|
4563
4513
|
// src/utils/actions/useClaimOrgActionReward.ts
|
|
4564
|
-
var
|
|
4514
|
+
var import_viem15 = require("viem");
|
|
4565
4515
|
var import_react30 = require("react");
|
|
4566
4516
|
function useClaimOrgActionReward() {
|
|
4567
4517
|
return (0, import_react30.useCallback)(
|
|
@@ -4572,13 +4522,13 @@ function useClaimOrgActionReward() {
|
|
|
4572
4522
|
message: "Missing web3auth account info or contract address."
|
|
4573
4523
|
};
|
|
4574
4524
|
}
|
|
4575
|
-
const claimCallData = (0,
|
|
4525
|
+
const claimCallData = (0, import_viem15.encodeFunctionData)({
|
|
4576
4526
|
abi: REWARDABLE_ACTIONS_ABI,
|
|
4577
4527
|
functionName: "claimByIndex",
|
|
4578
4528
|
args: [actionId, claimIndex]
|
|
4579
4529
|
});
|
|
4580
4530
|
const args = [rewardableActionContractAddress, claimCallData];
|
|
4581
|
-
const executeClaimCalldata = (0,
|
|
4531
|
+
const executeClaimCalldata = (0, import_viem15.encodeFunctionData)({
|
|
4582
4532
|
abi: ORGANIZATION_IMPL_ABI,
|
|
4583
4533
|
functionName: ORG_FUNCTION,
|
|
4584
4534
|
args
|
package/dist/index.mjs
CHANGED
|
@@ -2933,28 +2933,19 @@ function useCoinbaseMintAnymalNFT() {
|
|
|
2933
2933
|
}
|
|
2934
2934
|
|
|
2935
2935
|
// src/utils/coinbase/useCoinbaseCreateOrganizationWallet.ts
|
|
2936
|
-
import { useCallback as useCallback13
|
|
2937
|
-
import { createPublicClient as createPublicClient2, decodeEventLog, http as http2 } from "viem";
|
|
2938
|
-
import { baseSepolia as baseSepolia2 } from "viem/chains";
|
|
2936
|
+
import { useCallback as useCallback13 } from "react";
|
|
2939
2937
|
function useCoinbaseCreateOrganizationWallet() {
|
|
2940
|
-
const { sendOperationFn,
|
|
2941
|
-
|
|
2942
|
-
() => createPublicClient2({
|
|
2943
|
-
chain: baseSepolia2,
|
|
2944
|
-
transport: http2()
|
|
2945
|
-
}),
|
|
2946
|
-
[]
|
|
2947
|
-
);
|
|
2948
|
-
const createOrganization = useCallback13(
|
|
2938
|
+
const { sendOperationFn, status } = useSendCoinbaseUserOperation();
|
|
2939
|
+
return useCallback13(
|
|
2949
2940
|
/**
|
|
2950
2941
|
* Creates a new organization on-chain.
|
|
2951
2942
|
*
|
|
2952
|
-
* @param orgPid - The PID of the organization as registered in
|
|
2953
|
-
* @param orgName - The name of the organization as registered in
|
|
2943
|
+
* @param orgPid - The PID of the organization as registered in Firestore.
|
|
2944
|
+
* @param orgName - The name of the organization as registered in Firestore.
|
|
2954
2945
|
* @param ownerAddress - The wallet address of the user who will be the default manager.
|
|
2955
2946
|
* @param orgContractAddress - The contract address of the organization beacon.
|
|
2956
2947
|
* @param evmAddress - The Coinbase smart account address of the admin.
|
|
2957
|
-
* @returns A promise with success status, message, and
|
|
2948
|
+
* @returns A promise with success status, message, and status.
|
|
2958
2949
|
*/
|
|
2959
2950
|
async (orgPid, orgName, ownerAddress, orgContractAddress, evmAddress) => {
|
|
2960
2951
|
if (!orgPid || !orgName || !ownerAddress || !orgContractAddress || !evmAddress) {
|
|
@@ -2971,51 +2962,10 @@ function useCoinbaseCreateOrganizationWallet() {
|
|
|
2971
2962
|
"createOrganizationProxy",
|
|
2972
2963
|
[ownerAddress, orgName, orgPid]
|
|
2973
2964
|
);
|
|
2974
|
-
|
|
2975
|
-
return { ...result, status: "error" };
|
|
2976
|
-
}
|
|
2977
|
-
let proxyAddress;
|
|
2978
|
-
try {
|
|
2979
|
-
const txHash = data?.receipts?.[0]?.transactionHash || data?.transactionHash;
|
|
2980
|
-
if (txHash) {
|
|
2981
|
-
const receipt = await publicClient.getTransactionReceipt({
|
|
2982
|
-
hash: txHash
|
|
2983
|
-
});
|
|
2984
|
-
for (const log of receipt.logs) {
|
|
2985
|
-
try {
|
|
2986
|
-
const decoded = decodeEventLog({
|
|
2987
|
-
abi: ORGANIZATION_BEACON_ABI,
|
|
2988
|
-
data: log.data,
|
|
2989
|
-
topics: log.topics
|
|
2990
|
-
});
|
|
2991
|
-
if (decoded.eventName === "NewOrganizationCreated") {
|
|
2992
|
-
proxyAddress = decoded.args.proxyAddress;
|
|
2993
|
-
break;
|
|
2994
|
-
}
|
|
2995
|
-
} catch {
|
|
2996
|
-
}
|
|
2997
|
-
}
|
|
2998
|
-
}
|
|
2999
|
-
} catch (e) {
|
|
3000
|
-
console.error("Failed to get transaction receipt:", e);
|
|
3001
|
-
}
|
|
3002
|
-
if (!proxyAddress) {
|
|
3003
|
-
return {
|
|
3004
|
-
success: true,
|
|
3005
|
-
message: "Organization registered successfully, but proxy address not found in logs.",
|
|
3006
|
-
status
|
|
3007
|
-
};
|
|
3008
|
-
}
|
|
3009
|
-
return {
|
|
3010
|
-
success: true,
|
|
3011
|
-
message: "Organization registered successfully.",
|
|
3012
|
-
proxyAddress,
|
|
3013
|
-
status
|
|
3014
|
-
};
|
|
2965
|
+
return { ...result, status };
|
|
3015
2966
|
},
|
|
3016
|
-
[sendOperationFn,
|
|
2967
|
+
[sendOperationFn, status]
|
|
3017
2968
|
);
|
|
3018
|
-
return { createOrganization, status };
|
|
3019
2969
|
}
|
|
3020
2970
|
|
|
3021
2971
|
// src/utils/anymals/useMintAnymalNFT.ts
|
|
@@ -3530,7 +3480,7 @@ function useApproveKibbleToken() {
|
|
|
3530
3480
|
|
|
3531
3481
|
// src/utils/organization/useCreateOrganizationBase.ts
|
|
3532
3482
|
import { useCallback as useCallback19 } from "react";
|
|
3533
|
-
import { decodeEventLog
|
|
3483
|
+
import { decodeEventLog, encodeFunctionData as encodeFunctionData5 } from "viem";
|
|
3534
3484
|
function useCreateOrganizationBase() {
|
|
3535
3485
|
return useCallback19(
|
|
3536
3486
|
/**
|
|
@@ -3592,7 +3542,7 @@ function useCreateOrganizationBase() {
|
|
|
3592
3542
|
let proxyAddress;
|
|
3593
3543
|
for (const log of txReceipt.logs) {
|
|
3594
3544
|
try {
|
|
3595
|
-
const decoded =
|
|
3545
|
+
const decoded = decodeEventLog({
|
|
3596
3546
|
abi: ORGANIZATION_BEACON_ABI,
|
|
3597
3547
|
data: log.data,
|
|
3598
3548
|
topics: log.topics
|
package/package.json
CHANGED