@bze/bze-ui-kit 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +108 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +138 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3068,6 +3068,137 @@ function useConnectionType() {
|
|
|
3068
3068
|
// src/hooks/useSigningClient.ts
|
|
3069
3069
|
import { useCallback as useCallback2, useEffect, useRef, useState } from "react";
|
|
3070
3070
|
import { useChain } from "@interchain-kit/react";
|
|
3071
|
+
|
|
3072
|
+
// src/utils/signing_client_setup.ts
|
|
3073
|
+
import {
|
|
3074
|
+
MsgCreateMarket,
|
|
3075
|
+
MsgCreateOrder,
|
|
3076
|
+
MsgCancelOrder,
|
|
3077
|
+
MsgFillOrders,
|
|
3078
|
+
MsgCreateLiquidityPool,
|
|
3079
|
+
MsgAddLiquidity,
|
|
3080
|
+
MsgRemoveLiquidity,
|
|
3081
|
+
MsgMultiSwap
|
|
3082
|
+
} from "@bze/bzejs/bze/tradebin/tx";
|
|
3083
|
+
import {
|
|
3084
|
+
MsgCreateStakingReward,
|
|
3085
|
+
MsgUpdateStakingReward,
|
|
3086
|
+
MsgJoinStaking,
|
|
3087
|
+
MsgExitStaking,
|
|
3088
|
+
MsgClaimStakingRewards,
|
|
3089
|
+
MsgCreateTradingReward,
|
|
3090
|
+
MsgActivateTradingReward
|
|
3091
|
+
} from "@bze/bzejs/bze/rewards/tx";
|
|
3092
|
+
import { MsgFundBurner, MsgStartRaffle, MsgJoinRaffle } from "@bze/bzejs/bze/burner/tx";
|
|
3093
|
+
import { MsgCreateDenom, MsgMint, MsgBurn, MsgChangeAdmin, MsgSetDenomMetadata } from "@bze/bzejs/bze/tokenfactory/tx";
|
|
3094
|
+
import { MsgAddArticle, MsgPayPublisherRespect, MsgAcceptDomain, MsgSavePublisher } from "@bze/bzejs/bze/cointrunk/tx";
|
|
3095
|
+
import { MsgSend, MsgMultiSend } from "@bze/bzejs/cosmos/bank/v1beta1/tx";
|
|
3096
|
+
import {
|
|
3097
|
+
MsgDelegate,
|
|
3098
|
+
MsgUndelegate,
|
|
3099
|
+
MsgBeginRedelegate,
|
|
3100
|
+
MsgCancelUnbondingDelegation
|
|
3101
|
+
} from "@bze/bzejs/cosmos/staking/v1beta1/tx";
|
|
3102
|
+
import {
|
|
3103
|
+
MsgSetWithdrawAddress,
|
|
3104
|
+
MsgWithdrawDelegatorReward,
|
|
3105
|
+
MsgWithdrawValidatorCommission,
|
|
3106
|
+
MsgFundCommunityPool
|
|
3107
|
+
} from "@bze/bzejs/cosmos/distribution/v1beta1/tx";
|
|
3108
|
+
import {
|
|
3109
|
+
MsgSubmitProposal,
|
|
3110
|
+
MsgVote,
|
|
3111
|
+
MsgVoteWeighted,
|
|
3112
|
+
MsgDeposit,
|
|
3113
|
+
MsgCancelProposal
|
|
3114
|
+
} from "@bze/bzejs/cosmos/gov/v1/tx";
|
|
3115
|
+
import { MsgGrant, MsgExec, MsgRevoke } from "@bze/bzejs/cosmos/authz/v1beta1/tx";
|
|
3116
|
+
import { MsgGrantAllowance, MsgRevokeAllowance } from "@bze/bzejs/cosmos/feegrant/v1beta1/tx";
|
|
3117
|
+
import { MsgTransfer } from "@bze/bzejs/ibc/applications/transfer/v1/tx";
|
|
3118
|
+
var toEncoder = (g) => ({
|
|
3119
|
+
typeUrl: g.typeUrl,
|
|
3120
|
+
fromPartial: g.fromPartial,
|
|
3121
|
+
encode: (data) => {
|
|
3122
|
+
const encoded = g.encode(g.fromPartial(data));
|
|
3123
|
+
return encoded.finish ? encoded.finish() : encoded;
|
|
3124
|
+
}
|
|
3125
|
+
});
|
|
3126
|
+
var toConverter = (g) => ({
|
|
3127
|
+
typeUrl: g.typeUrl,
|
|
3128
|
+
aminoType: g.aminoType,
|
|
3129
|
+
fromAmino: g.fromAmino,
|
|
3130
|
+
toAmino: g.toAmino
|
|
3131
|
+
});
|
|
3132
|
+
var ALL_MSG_TYPES = [
|
|
3133
|
+
// BZE tradebin
|
|
3134
|
+
MsgCreateMarket,
|
|
3135
|
+
MsgCreateOrder,
|
|
3136
|
+
MsgCancelOrder,
|
|
3137
|
+
MsgFillOrders,
|
|
3138
|
+
MsgCreateLiquidityPool,
|
|
3139
|
+
MsgAddLiquidity,
|
|
3140
|
+
MsgRemoveLiquidity,
|
|
3141
|
+
MsgMultiSwap,
|
|
3142
|
+
// BZE rewards
|
|
3143
|
+
MsgCreateStakingReward,
|
|
3144
|
+
MsgUpdateStakingReward,
|
|
3145
|
+
MsgJoinStaking,
|
|
3146
|
+
MsgExitStaking,
|
|
3147
|
+
MsgClaimStakingRewards,
|
|
3148
|
+
MsgCreateTradingReward,
|
|
3149
|
+
MsgActivateTradingReward,
|
|
3150
|
+
// BZE burner
|
|
3151
|
+
MsgFundBurner,
|
|
3152
|
+
MsgStartRaffle,
|
|
3153
|
+
MsgJoinRaffle,
|
|
3154
|
+
// BZE tokenfactory
|
|
3155
|
+
MsgCreateDenom,
|
|
3156
|
+
MsgMint,
|
|
3157
|
+
MsgBurn,
|
|
3158
|
+
MsgChangeAdmin,
|
|
3159
|
+
MsgSetDenomMetadata,
|
|
3160
|
+
// BZE cointrunk
|
|
3161
|
+
MsgAddArticle,
|
|
3162
|
+
MsgPayPublisherRespect,
|
|
3163
|
+
MsgAcceptDomain,
|
|
3164
|
+
MsgSavePublisher,
|
|
3165
|
+
// Cosmos bank
|
|
3166
|
+
MsgSend,
|
|
3167
|
+
MsgMultiSend,
|
|
3168
|
+
// Cosmos staking
|
|
3169
|
+
MsgDelegate,
|
|
3170
|
+
MsgUndelegate,
|
|
3171
|
+
MsgBeginRedelegate,
|
|
3172
|
+
MsgCancelUnbondingDelegation,
|
|
3173
|
+
// Cosmos distribution
|
|
3174
|
+
MsgSetWithdrawAddress,
|
|
3175
|
+
MsgWithdrawDelegatorReward,
|
|
3176
|
+
MsgWithdrawValidatorCommission,
|
|
3177
|
+
MsgFundCommunityPool,
|
|
3178
|
+
// Cosmos gov
|
|
3179
|
+
MsgSubmitProposal,
|
|
3180
|
+
MsgVote,
|
|
3181
|
+
MsgVoteWeighted,
|
|
3182
|
+
MsgDeposit,
|
|
3183
|
+
MsgCancelProposal,
|
|
3184
|
+
// Cosmos authz
|
|
3185
|
+
MsgGrant,
|
|
3186
|
+
MsgExec,
|
|
3187
|
+
MsgRevoke,
|
|
3188
|
+
// Cosmos feegrant
|
|
3189
|
+
MsgGrantAllowance,
|
|
3190
|
+
MsgRevokeAllowance,
|
|
3191
|
+
// IBC transfer
|
|
3192
|
+
MsgTransfer
|
|
3193
|
+
];
|
|
3194
|
+
var registerBzeEncoders = (client) => {
|
|
3195
|
+
var _a2, _b2;
|
|
3196
|
+
if (!client) return;
|
|
3197
|
+
(_a2 = client.addEncoders) == null ? void 0 : _a2.call(client, ALL_MSG_TYPES.map(toEncoder));
|
|
3198
|
+
(_b2 = client.addConverters) == null ? void 0 : _b2.call(client, ALL_MSG_TYPES.map(toConverter));
|
|
3199
|
+
};
|
|
3200
|
+
|
|
3201
|
+
// src/hooks/useSigningClient.ts
|
|
3071
3202
|
var useSigningClient = ({ chainName }) => {
|
|
3072
3203
|
const { getSigningClient, signingClientError, wallet, chain } = useChain(chainName != null ? chainName : getChainName());
|
|
3073
3204
|
const [signingClient, setSigningClient] = useState(null);
|
|
@@ -3083,6 +3214,7 @@ var useSigningClient = ({ chainName }) => {
|
|
|
3083
3214
|
const load = async () => {
|
|
3084
3215
|
const client = await createSigningClient();
|
|
3085
3216
|
if (client) {
|
|
3217
|
+
registerBzeEncoders(client);
|
|
3086
3218
|
setSigningClient(client);
|
|
3087
3219
|
setIsSigningClientReady(true);
|
|
3088
3220
|
hasInitialized.current = true;
|
|
@@ -3906,11 +4038,14 @@ var useTx = (chainName) => {
|
|
|
3906
4038
|
try {
|
|
3907
4039
|
const fee = await getFee(msgs, options);
|
|
3908
4040
|
setProgressTrack("Signing transaction");
|
|
3909
|
-
const
|
|
3910
|
-
|
|
4041
|
+
const broadcastResult = await signingClient.signAndBroadcast(address, msgs, fee, (_a2 = options == null ? void 0 : options.memo) != null ? _a2 : DEFAULT_TX_MEMO);
|
|
4042
|
+
setProgressTrack("Waiting for confirmation");
|
|
4043
|
+
const resp = await broadcastResult.wait();
|
|
4044
|
+
const txHash = (resp == null ? void 0 : resp.txhash) || broadcastResult.transactionHash;
|
|
4045
|
+
if ((resp == null ? void 0 : resp.code) === 0) {
|
|
3911
4046
|
setProgressTrack("Transaction sent");
|
|
3912
4047
|
toast.clickableSuccess("Transaction Successful" /* Successful */, () => {
|
|
3913
|
-
openExternalLink(`${getChainExplorerURL(chainName != null ? chainName : defaultChainName)}/tx/${
|
|
4048
|
+
openExternalLink(`${getChainExplorerURL(chainName != null ? chainName : defaultChainName)}/tx/${txHash}`);
|
|
3914
4049
|
}, "View in Explorer");
|
|
3915
4050
|
if (options == null ? void 0 : options.onSuccess) {
|
|
3916
4051
|
options.onSuccess(resp);
|