anymal-protocol 1.0.137 → 1.0.139
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 +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +88 -41
- package/dist/index.mjs +54 -7
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -431,6 +431,7 @@ declare const ORG_FUNCTION = "executeCall";
|
|
|
431
431
|
declare function useCoinbaseCreateOrganizationWallet(): (orgPid: string, orgName: string, ownerAddress: string, orgContractAddress: `0x${string}`, evmAddress: `0x${string}`) => Promise<{
|
|
432
432
|
success: boolean;
|
|
433
433
|
message: string;
|
|
434
|
+
proxyAddress?: string;
|
|
434
435
|
status: string;
|
|
435
436
|
}>;
|
|
436
437
|
|
package/dist/index.d.ts
CHANGED
|
@@ -431,6 +431,7 @@ declare const ORG_FUNCTION = "executeCall";
|
|
|
431
431
|
declare function useCoinbaseCreateOrganizationWallet(): (orgPid: string, orgName: string, ownerAddress: string, orgContractAddress: `0x${string}`, evmAddress: `0x${string}`) => Promise<{
|
|
432
432
|
success: boolean;
|
|
433
433
|
message: string;
|
|
434
|
+
proxyAddress?: string;
|
|
434
435
|
status: string;
|
|
435
436
|
}>;
|
|
436
437
|
|
package/dist/index.js
CHANGED
|
@@ -3013,8 +3013,17 @@ 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");
|
|
3016
3018
|
function useCoinbaseCreateOrganizationWallet() {
|
|
3017
|
-
const { sendOperationFn, status } = useSendCoinbaseUserOperation();
|
|
3019
|
+
const { sendOperationFn, data, status } = useSendCoinbaseUserOperation();
|
|
3020
|
+
const publicClient = (0, import_react13.useMemo)(
|
|
3021
|
+
() => (0, import_viem3.createPublicClient)({
|
|
3022
|
+
chain: import_chains2.baseSepolia,
|
|
3023
|
+
transport: (0, import_viem3.http)()
|
|
3024
|
+
}),
|
|
3025
|
+
[]
|
|
3026
|
+
);
|
|
3018
3027
|
return (0, import_react13.useCallback)(
|
|
3019
3028
|
/**
|
|
3020
3029
|
* Creates a new organization on-chain.
|
|
@@ -3024,7 +3033,7 @@ function useCoinbaseCreateOrganizationWallet() {
|
|
|
3024
3033
|
* @param ownerAddress - The wallet address of the user who will be the default manager.
|
|
3025
3034
|
* @param orgContractAddress - The contract address of the organization beacon.
|
|
3026
3035
|
* @param evmAddress - The Coinbase smart account address of the admin.
|
|
3027
|
-
* @returns A promise with success status, message, and
|
|
3036
|
+
* @returns A promise with success status, message, and optional proxyAddress.
|
|
3028
3037
|
*/
|
|
3029
3038
|
async (orgPid, orgName, ownerAddress, orgContractAddress, evmAddress) => {
|
|
3030
3039
|
if (!orgPid || !orgName || !ownerAddress || !orgContractAddress || !evmAddress) {
|
|
@@ -3041,14 +3050,52 @@ function useCoinbaseCreateOrganizationWallet() {
|
|
|
3041
3050
|
"createOrganizationProxy",
|
|
3042
3051
|
[ownerAddress, orgName, orgPid]
|
|
3043
3052
|
);
|
|
3044
|
-
|
|
3053
|
+
if (!result.success) {
|
|
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
|
+
...result,
|
|
3084
|
+
status
|
|
3085
|
+
};
|
|
3086
|
+
}
|
|
3087
|
+
return {
|
|
3088
|
+
...result,
|
|
3089
|
+
proxyAddress,
|
|
3090
|
+
status
|
|
3091
|
+
};
|
|
3045
3092
|
},
|
|
3046
|
-
[sendOperationFn, status]
|
|
3093
|
+
[sendOperationFn, data, publicClient, status]
|
|
3047
3094
|
);
|
|
3048
3095
|
}
|
|
3049
3096
|
|
|
3050
3097
|
// src/utils/anymals/useMintAnymalNFT.ts
|
|
3051
|
-
var
|
|
3098
|
+
var import_viem5 = require("viem");
|
|
3052
3099
|
var import_react14 = require("react");
|
|
3053
3100
|
|
|
3054
3101
|
// src/helpers/GasEstimateHelper.tsx
|
|
@@ -3093,18 +3140,18 @@ async function applyBundlerGasEstimator(account, bundlerClient, options) {
|
|
|
3093
3140
|
}
|
|
3094
3141
|
|
|
3095
3142
|
// src/helpers/HumanRevert.tsx
|
|
3096
|
-
var
|
|
3143
|
+
var import_viem4 = require("viem");
|
|
3097
3144
|
function humanRevert(raw, shortMessage) {
|
|
3098
3145
|
if (!raw) return shortMessage ?? "Simulation reverted";
|
|
3099
3146
|
try {
|
|
3100
|
-
const { errorName, args } = (0,
|
|
3147
|
+
const { errorName, args } = (0, import_viem4.decodeErrorResult)({
|
|
3101
3148
|
abi: ERROR_ABI,
|
|
3102
3149
|
data: raw
|
|
3103
3150
|
});
|
|
3104
3151
|
return `${errorName}(${args.map(String).join(", ")})`;
|
|
3105
3152
|
} catch {
|
|
3106
3153
|
if (raw.startsWith("0x08c379a0") && raw.length >= 138) {
|
|
3107
|
-
return (0,
|
|
3154
|
+
return (0, import_viem4.hexToString)(`0x${raw.slice(138)}`);
|
|
3108
3155
|
}
|
|
3109
3156
|
return `${raw.slice(0, 10)}\u2026`;
|
|
3110
3157
|
}
|
|
@@ -3146,7 +3193,7 @@ function useMintAnymalNFT() {
|
|
|
3146
3193
|
"petastic-signup-campaign-1",
|
|
3147
3194
|
anymalTxId
|
|
3148
3195
|
];
|
|
3149
|
-
const callData = (0,
|
|
3196
|
+
const callData = (0, import_viem5.encodeFunctionData)({
|
|
3150
3197
|
abi: PET_NFT_ABI,
|
|
3151
3198
|
functionName,
|
|
3152
3199
|
args
|
|
@@ -3333,7 +3380,7 @@ function useUploadAnymalImage() {
|
|
|
3333
3380
|
var import_react17 = require("react");
|
|
3334
3381
|
|
|
3335
3382
|
// src/helpers/ProcessDirectPartialPayment.tsx
|
|
3336
|
-
var
|
|
3383
|
+
var import_viem6 = require("viem");
|
|
3337
3384
|
|
|
3338
3385
|
// src/helpers/SendUserOpWithRetries.tsx
|
|
3339
3386
|
async function sendUserOpWithRetries(bundlerClient, params, retries = 3, delay = 1e3) {
|
|
@@ -3393,7 +3440,7 @@ async function processDirectPartialPayment(marketplaceContract, smartAccount, bu
|
|
|
3393
3440
|
deadline,
|
|
3394
3441
|
backendSignature
|
|
3395
3442
|
];
|
|
3396
|
-
const partialPayCalldata = (0,
|
|
3443
|
+
const partialPayCalldata = (0, import_viem6.encodeFunctionData)({
|
|
3397
3444
|
abi: MARKETPLACE_ABI,
|
|
3398
3445
|
functionName,
|
|
3399
3446
|
args
|
|
@@ -3489,20 +3536,20 @@ function useProcessPartialKibblePayment() {
|
|
|
3489
3536
|
var import_react18 = require("react");
|
|
3490
3537
|
|
|
3491
3538
|
// src/helpers/ProcessDirectKibbleApproval.tsx
|
|
3492
|
-
var
|
|
3539
|
+
var import_viem7 = require("viem");
|
|
3493
3540
|
async function processDirectKibbleApproval(kibbleTokenAddress, spenderAddress, smartAccount, bundlerClient, approveAmount) {
|
|
3494
3541
|
try {
|
|
3495
3542
|
const functionName = "approve";
|
|
3496
3543
|
const args = [spenderAddress, approveAmount];
|
|
3497
|
-
const approveCalldata = (0,
|
|
3498
|
-
abi:
|
|
3544
|
+
const approveCalldata = (0, import_viem7.encodeFunctionData)({
|
|
3545
|
+
abi: import_viem7.erc20Abi,
|
|
3499
3546
|
functionName,
|
|
3500
3547
|
args
|
|
3501
3548
|
});
|
|
3502
3549
|
await simulateCall(
|
|
3503
3550
|
bundlerClient.client,
|
|
3504
3551
|
kibbleTokenAddress,
|
|
3505
|
-
|
|
3552
|
+
import_viem7.erc20Abi,
|
|
3506
3553
|
functionName,
|
|
3507
3554
|
args,
|
|
3508
3555
|
smartAccount.address
|
|
@@ -3559,7 +3606,7 @@ function useApproveKibbleToken() {
|
|
|
3559
3606
|
|
|
3560
3607
|
// src/utils/organization/useCreateOrganizationBase.ts
|
|
3561
3608
|
var import_react19 = require("react");
|
|
3562
|
-
var
|
|
3609
|
+
var import_viem8 = require("viem");
|
|
3563
3610
|
function useCreateOrganizationBase() {
|
|
3564
3611
|
return (0, import_react19.useCallback)(
|
|
3565
3612
|
/**
|
|
@@ -3583,7 +3630,7 @@ function useCreateOrganizationBase() {
|
|
|
3583
3630
|
try {
|
|
3584
3631
|
const functionName = "createOrganizationProxy";
|
|
3585
3632
|
const args = [ownerAddress, orgName, orgPid];
|
|
3586
|
-
const callData = (0,
|
|
3633
|
+
const callData = (0, import_viem8.encodeFunctionData)({
|
|
3587
3634
|
abi: ORGANIZATION_BEACON_ABI,
|
|
3588
3635
|
functionName,
|
|
3589
3636
|
args
|
|
@@ -3621,7 +3668,7 @@ function useCreateOrganizationBase() {
|
|
|
3621
3668
|
let proxyAddress;
|
|
3622
3669
|
for (const log of txReceipt.logs) {
|
|
3623
3670
|
try {
|
|
3624
|
-
const decoded = (0,
|
|
3671
|
+
const decoded = (0, import_viem8.decodeEventLog)({
|
|
3625
3672
|
abi: ORGANIZATION_BEACON_ABI,
|
|
3626
3673
|
data: log.data,
|
|
3627
3674
|
topics: log.topics
|
|
@@ -3660,10 +3707,10 @@ function useCreateOrganizationBase() {
|
|
|
3660
3707
|
var import_react20 = require("react");
|
|
3661
3708
|
|
|
3662
3709
|
// src/helpers/ProcessOrgKibbleApproval.tsx
|
|
3663
|
-
var
|
|
3710
|
+
var import_viem10 = require("viem");
|
|
3664
3711
|
|
|
3665
3712
|
// src/helpers/WaitForAllowance.tsx
|
|
3666
|
-
var
|
|
3713
|
+
var import_viem9 = require("viem");
|
|
3667
3714
|
async function waitForAllowance(publicClient, tokenAddress, ownerAddress, spenderAddress, expectedAmount) {
|
|
3668
3715
|
const MAX_RETRIES = 10;
|
|
3669
3716
|
const RETRY_INTERVAL = 2e3;
|
|
@@ -3672,7 +3719,7 @@ async function waitForAllowance(publicClient, tokenAddress, ownerAddress, spende
|
|
|
3672
3719
|
try {
|
|
3673
3720
|
const currentAllowance = await publicClient.readContract({
|
|
3674
3721
|
address: tokenAddress,
|
|
3675
|
-
abi:
|
|
3722
|
+
abi: import_viem9.erc20Abi,
|
|
3676
3723
|
functionName: "allowance",
|
|
3677
3724
|
args: [ownerAddress, spenderAddress]
|
|
3678
3725
|
});
|
|
@@ -3697,13 +3744,13 @@ async function processOrgKibbleApproval(orgContractAddress, kibbleTokenAddress,
|
|
|
3697
3744
|
if (approveAmount <= 0n) {
|
|
3698
3745
|
return { success: false, message: "Approval amount must be greater than zero." };
|
|
3699
3746
|
}
|
|
3700
|
-
const approveCalldata = (0,
|
|
3701
|
-
abi:
|
|
3747
|
+
const approveCalldata = (0, import_viem10.encodeFunctionData)({
|
|
3748
|
+
abi: import_viem10.erc20Abi,
|
|
3702
3749
|
functionName: "approve",
|
|
3703
3750
|
args: [partialPaymentModuleAddress, approveAmount]
|
|
3704
3751
|
});
|
|
3705
3752
|
const args = [kibbleTokenAddress, approveCalldata];
|
|
3706
|
-
const executeApproveCalldata = (0,
|
|
3753
|
+
const executeApproveCalldata = (0, import_viem10.encodeFunctionData)({
|
|
3707
3754
|
abi: ORGANIZATION_IMPL_ABI,
|
|
3708
3755
|
functionName: ORG_FUNCTION,
|
|
3709
3756
|
args
|
|
@@ -3790,10 +3837,10 @@ function useApproveOrgPartialPayment() {
|
|
|
3790
3837
|
var import_react21 = require("react");
|
|
3791
3838
|
|
|
3792
3839
|
// src/helpers/ProcessOrgPartialPayment.tsx
|
|
3793
|
-
var
|
|
3840
|
+
var import_viem11 = require("viem");
|
|
3794
3841
|
async function processOrgPartialPayment(orgContractAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, orderId, anymalNftId, pid, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) {
|
|
3795
3842
|
try {
|
|
3796
|
-
const partialPayCalldata = (0,
|
|
3843
|
+
const partialPayCalldata = (0, import_viem11.encodeFunctionData)({
|
|
3797
3844
|
abi: MARKETPLACE_ABI,
|
|
3798
3845
|
functionName: "partialPay",
|
|
3799
3846
|
args: [
|
|
@@ -3808,7 +3855,7 @@ async function processOrgPartialPayment(orgContractAddress, partialPaymentModule
|
|
|
3808
3855
|
]
|
|
3809
3856
|
});
|
|
3810
3857
|
const args = [partialPaymentModuleAddress, partialPayCalldata];
|
|
3811
|
-
const executePartialPayCalldata = (0,
|
|
3858
|
+
const executePartialPayCalldata = (0, import_viem11.encodeFunctionData)({
|
|
3812
3859
|
abi: ORGANIZATION_IMPL_ABI,
|
|
3813
3860
|
functionName: ORG_FUNCTION,
|
|
3814
3861
|
args
|
|
@@ -3924,7 +3971,7 @@ function useUpdateOrgWalletAddress() {
|
|
|
3924
3971
|
}
|
|
3925
3972
|
|
|
3926
3973
|
// src/utils/organization/useMintOrgAnymalNFT.ts
|
|
3927
|
-
var
|
|
3974
|
+
var import_viem12 = require("viem");
|
|
3928
3975
|
var import_react23 = require("react");
|
|
3929
3976
|
function useMintOrgAnymalNFT() {
|
|
3930
3977
|
return (0, import_react23.useCallback)(
|
|
@@ -3943,13 +3990,13 @@ function useMintOrgAnymalNFT() {
|
|
|
3943
3990
|
"petastic-signup-campaign-1",
|
|
3944
3991
|
anymalTxId
|
|
3945
3992
|
];
|
|
3946
|
-
const callData = (0,
|
|
3993
|
+
const callData = (0, import_viem12.encodeFunctionData)({
|
|
3947
3994
|
abi: PET_NFT_ABI,
|
|
3948
3995
|
functionName,
|
|
3949
3996
|
args
|
|
3950
3997
|
});
|
|
3951
3998
|
const executeArgs = [validationContractAddress, callData];
|
|
3952
|
-
const executeSubmitMetaCalldata = (0,
|
|
3999
|
+
const executeSubmitMetaCalldata = (0, import_viem12.encodeFunctionData)({
|
|
3953
4000
|
abi: ORGANIZATION_IMPL_ABI,
|
|
3954
4001
|
functionName: ORG_FUNCTION,
|
|
3955
4002
|
args: executeArgs
|
|
@@ -3982,10 +4029,10 @@ function useMintOrgAnymalNFT() {
|
|
|
3982
4029
|
|
|
3983
4030
|
// src/helpers/NonceHelper.tsx
|
|
3984
4031
|
var import_uuid = require("uuid");
|
|
3985
|
-
var
|
|
4032
|
+
var import_viem13 = require("viem");
|
|
3986
4033
|
var generateBytes32Nonce = () => {
|
|
3987
4034
|
const uuid3 = (0, import_uuid.v4)().replace(/-/g, "");
|
|
3988
|
-
return (0,
|
|
4035
|
+
return (0, import_viem13.padHex)(`0x${uuid3}`, { size: 32 });
|
|
3989
4036
|
};
|
|
3990
4037
|
|
|
3991
4038
|
// src/helpers/CryptoUtils.tsx
|
|
@@ -4441,16 +4488,16 @@ function useCreateOrganizationAppData() {
|
|
|
4441
4488
|
|
|
4442
4489
|
// src/utils/balance/useFetchBalance.ts
|
|
4443
4490
|
var import_react28 = require("react");
|
|
4444
|
-
var
|
|
4491
|
+
var import_viem14 = require("viem");
|
|
4445
4492
|
function useFetchBalance() {
|
|
4446
4493
|
return (0, import_react28.useCallback)(
|
|
4447
4494
|
async (publicClient, walletAddress, kibbleTokenAddress) => {
|
|
4448
4495
|
try {
|
|
4449
4496
|
const balance = await publicClient.readContract({
|
|
4450
|
-
address: (0,
|
|
4451
|
-
abi:
|
|
4497
|
+
address: (0, import_viem14.getAddress)(kibbleTokenAddress),
|
|
4498
|
+
abi: import_viem14.erc20Abi,
|
|
4452
4499
|
functionName: "balanceOf",
|
|
4453
|
-
args: [(0,
|
|
4500
|
+
args: [(0, import_viem14.getAddress)(walletAddress)]
|
|
4454
4501
|
});
|
|
4455
4502
|
return Number(balance);
|
|
4456
4503
|
} catch (error) {
|
|
@@ -4462,7 +4509,7 @@ function useFetchBalance() {
|
|
|
4462
4509
|
}
|
|
4463
4510
|
|
|
4464
4511
|
// src/utils/actions/useClaimActionReward.ts
|
|
4465
|
-
var
|
|
4512
|
+
var import_viem15 = require("viem");
|
|
4466
4513
|
var import_react29 = require("react");
|
|
4467
4514
|
function useClaimActionReward() {
|
|
4468
4515
|
return (0, import_react29.useCallback)(
|
|
@@ -4475,7 +4522,7 @@ function useClaimActionReward() {
|
|
|
4475
4522
|
}
|
|
4476
4523
|
const args = [actionId, claimIndex];
|
|
4477
4524
|
const functionName = "claimByIndex";
|
|
4478
|
-
const callData = (0,
|
|
4525
|
+
const callData = (0, import_viem15.encodeFunctionData)({
|
|
4479
4526
|
abi: REWARDABLE_ACTIONS_ABI,
|
|
4480
4527
|
functionName,
|
|
4481
4528
|
args
|
|
@@ -4511,7 +4558,7 @@ function useClaimActionReward() {
|
|
|
4511
4558
|
}
|
|
4512
4559
|
|
|
4513
4560
|
// src/utils/actions/useClaimOrgActionReward.ts
|
|
4514
|
-
var
|
|
4561
|
+
var import_viem16 = require("viem");
|
|
4515
4562
|
var import_react30 = require("react");
|
|
4516
4563
|
function useClaimOrgActionReward() {
|
|
4517
4564
|
return (0, import_react30.useCallback)(
|
|
@@ -4522,13 +4569,13 @@ function useClaimOrgActionReward() {
|
|
|
4522
4569
|
message: "Missing web3auth account info or contract address."
|
|
4523
4570
|
};
|
|
4524
4571
|
}
|
|
4525
|
-
const claimCallData = (0,
|
|
4572
|
+
const claimCallData = (0, import_viem16.encodeFunctionData)({
|
|
4526
4573
|
abi: REWARDABLE_ACTIONS_ABI,
|
|
4527
4574
|
functionName: "claimByIndex",
|
|
4528
4575
|
args: [actionId, claimIndex]
|
|
4529
4576
|
});
|
|
4530
4577
|
const args = [rewardableActionContractAddress, claimCallData];
|
|
4531
|
-
const executeClaimCalldata = (0,
|
|
4578
|
+
const executeClaimCalldata = (0, import_viem16.encodeFunctionData)({
|
|
4532
4579
|
abi: ORGANIZATION_IMPL_ABI,
|
|
4533
4580
|
functionName: ORG_FUNCTION,
|
|
4534
4581
|
args
|
package/dist/index.mjs
CHANGED
|
@@ -2933,9 +2933,18 @@ function useCoinbaseMintAnymalNFT() {
|
|
|
2933
2933
|
}
|
|
2934
2934
|
|
|
2935
2935
|
// src/utils/coinbase/useCoinbaseCreateOrganizationWallet.ts
|
|
2936
|
-
import { useCallback as useCallback13 } from "react";
|
|
2936
|
+
import { useCallback as useCallback13, useMemo as useMemo2 } from "react";
|
|
2937
|
+
import { createPublicClient as createPublicClient2, decodeEventLog, http as http2 } from "viem";
|
|
2938
|
+
import { baseSepolia as baseSepolia2 } from "viem/chains";
|
|
2937
2939
|
function useCoinbaseCreateOrganizationWallet() {
|
|
2938
|
-
const { sendOperationFn, status } = useSendCoinbaseUserOperation();
|
|
2940
|
+
const { sendOperationFn, data, status } = useSendCoinbaseUserOperation();
|
|
2941
|
+
const publicClient = useMemo2(
|
|
2942
|
+
() => createPublicClient2({
|
|
2943
|
+
chain: baseSepolia2,
|
|
2944
|
+
transport: http2()
|
|
2945
|
+
}),
|
|
2946
|
+
[]
|
|
2947
|
+
);
|
|
2939
2948
|
return useCallback13(
|
|
2940
2949
|
/**
|
|
2941
2950
|
* Creates a new organization on-chain.
|
|
@@ -2945,7 +2954,7 @@ function useCoinbaseCreateOrganizationWallet() {
|
|
|
2945
2954
|
* @param ownerAddress - The wallet address of the user who will be the default manager.
|
|
2946
2955
|
* @param orgContractAddress - The contract address of the organization beacon.
|
|
2947
2956
|
* @param evmAddress - The Coinbase smart account address of the admin.
|
|
2948
|
-
* @returns A promise with success status, message, and
|
|
2957
|
+
* @returns A promise with success status, message, and optional proxyAddress.
|
|
2949
2958
|
*/
|
|
2950
2959
|
async (orgPid, orgName, ownerAddress, orgContractAddress, evmAddress) => {
|
|
2951
2960
|
if (!orgPid || !orgName || !ownerAddress || !orgContractAddress || !evmAddress) {
|
|
@@ -2962,9 +2971,47 @@ function useCoinbaseCreateOrganizationWallet() {
|
|
|
2962
2971
|
"createOrganizationProxy",
|
|
2963
2972
|
[ownerAddress, orgName, orgPid]
|
|
2964
2973
|
);
|
|
2965
|
-
|
|
2974
|
+
if (!result.success) {
|
|
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
|
+
...result,
|
|
3005
|
+
status
|
|
3006
|
+
};
|
|
3007
|
+
}
|
|
3008
|
+
return {
|
|
3009
|
+
...result,
|
|
3010
|
+
proxyAddress,
|
|
3011
|
+
status
|
|
3012
|
+
};
|
|
2966
3013
|
},
|
|
2967
|
-
[sendOperationFn, status]
|
|
3014
|
+
[sendOperationFn, data, publicClient, status]
|
|
2968
3015
|
);
|
|
2969
3016
|
}
|
|
2970
3017
|
|
|
@@ -3480,7 +3527,7 @@ function useApproveKibbleToken() {
|
|
|
3480
3527
|
|
|
3481
3528
|
// src/utils/organization/useCreateOrganizationBase.ts
|
|
3482
3529
|
import { useCallback as useCallback19 } from "react";
|
|
3483
|
-
import { decodeEventLog, encodeFunctionData as encodeFunctionData5 } from "viem";
|
|
3530
|
+
import { decodeEventLog as decodeEventLog2, encodeFunctionData as encodeFunctionData5 } from "viem";
|
|
3484
3531
|
function useCreateOrganizationBase() {
|
|
3485
3532
|
return useCallback19(
|
|
3486
3533
|
/**
|
|
@@ -3542,7 +3589,7 @@ function useCreateOrganizationBase() {
|
|
|
3542
3589
|
let proxyAddress;
|
|
3543
3590
|
for (const log of txReceipt.logs) {
|
|
3544
3591
|
try {
|
|
3545
|
-
const decoded =
|
|
3592
|
+
const decoded = decodeEventLog2({
|
|
3546
3593
|
abi: ORGANIZATION_BEACON_ABI,
|
|
3547
3594
|
data: log.data,
|
|
3548
3595
|
topics: log.topics
|
package/package.json
CHANGED