@initia/interwovenkit-react 2.0.0-rc.1
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/README.md +222 -0
- package/dist/index.cjs +4 -0
- package/dist/index.d.ts +153 -0
- package/dist/index.js +4692 -0
- package/dist/styles.css +1 -0
- package/dist/styles.d.ts +2 -0
- package/dist/styles.js +1 -0
- package/package.json +135 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { AminoConverters } from '@cosmjs/stargate';
|
|
2
|
+
import { Chain } from '@initia/initia-registry-types';
|
|
3
|
+
import { DeliverTxResponse } from '@cosmjs/stargate';
|
|
4
|
+
import { EncodeObject } from '@cosmjs/proto-signing';
|
|
5
|
+
import { GeneratedType } from '@cosmjs/proto-signing';
|
|
6
|
+
import { IndexedTx } from '@cosmjs/stargate';
|
|
7
|
+
import { JSX } from 'react/jsx-runtime';
|
|
8
|
+
import { PropsWithChildren } from 'react';
|
|
9
|
+
import { StdFee } from '@cosmjs/stargate';
|
|
10
|
+
import { UseQueryResult } from '@tanstack/react-query';
|
|
11
|
+
import { z } from 'zod';
|
|
12
|
+
|
|
13
|
+
export declare const AddressUtils: {
|
|
14
|
+
toBytes(address: string, byteLength?: number): Uint8Array<ArrayBufferLike>;
|
|
15
|
+
toBech32(address: string, prefix?: string): string;
|
|
16
|
+
toHex(address: string): string;
|
|
17
|
+
toPrefixedHex(address: string): string;
|
|
18
|
+
validate(address: string, prefix?: string): boolean;
|
|
19
|
+
equals(address1: string, address2: string): boolean;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
declare interface Config {
|
|
23
|
+
defaultChainId: string;
|
|
24
|
+
customChain?: Chain;
|
|
25
|
+
protoTypes?: Iterable<[string, GeneratedType]>;
|
|
26
|
+
aminoConverters?: AminoConverters;
|
|
27
|
+
registryUrl: string;
|
|
28
|
+
routerApiUrl: string;
|
|
29
|
+
usernamesModuleAddress: string;
|
|
30
|
+
theme: "light" | "dark";
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export declare function createUsernameClient({ restUrl, moduleAddress }: Params): {
|
|
34
|
+
restUrl: string;
|
|
35
|
+
getUsername: (address: string) => Promise<string | null>;
|
|
36
|
+
getAddress: (username: string) => Promise<string | null>;
|
|
37
|
+
validateUsername: (username: string) => boolean;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export declare const DEFAULT_GAS_ADJUSTMENT = 1.4;
|
|
41
|
+
|
|
42
|
+
export declare const DEFAULT_GAS_PRICE_MULTIPLIER = 1.03;
|
|
43
|
+
|
|
44
|
+
export declare function formatAmount(value?: BigNumber.Value, options?: FormatAmountOptions): string;
|
|
45
|
+
|
|
46
|
+
export declare interface FormatAmountOptions extends FormatNumberOptions {
|
|
47
|
+
decimals?: number;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export declare function formatNumber(value: BigNumber.Value, options?: FormatNumberOptions): string;
|
|
51
|
+
|
|
52
|
+
export declare interface FormatNumberOptions {
|
|
53
|
+
dp?: number;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export declare function formatPercent(value?: BigNumber.Value, fixed?: number): string;
|
|
57
|
+
|
|
58
|
+
declare type FormValues = z.infer<typeof FormValuesSchema>;
|
|
59
|
+
|
|
60
|
+
declare const FormValuesSchema: z.ZodObject<{
|
|
61
|
+
srcChainId: z.ZodString;
|
|
62
|
+
srcDenom: z.ZodString;
|
|
63
|
+
dstChainId: z.ZodString;
|
|
64
|
+
dstDenom: z.ZodString;
|
|
65
|
+
quantity: z.ZodString;
|
|
66
|
+
sender: z.ZodString;
|
|
67
|
+
cosmosWalletName: z.ZodOptional<z.ZodString>;
|
|
68
|
+
recipient: z.ZodString;
|
|
69
|
+
slippagePercent: z.ZodString;
|
|
70
|
+
}, "strip", z.ZodTypeAny, {
|
|
71
|
+
srcChainId: string;
|
|
72
|
+
srcDenom: string;
|
|
73
|
+
dstChainId: string;
|
|
74
|
+
dstDenom: string;
|
|
75
|
+
quantity: string;
|
|
76
|
+
sender: string;
|
|
77
|
+
recipient: string;
|
|
78
|
+
slippagePercent: string;
|
|
79
|
+
cosmosWalletName?: string | undefined;
|
|
80
|
+
}, {
|
|
81
|
+
srcChainId: string;
|
|
82
|
+
srcDenom: string;
|
|
83
|
+
dstChainId: string;
|
|
84
|
+
dstDenom: string;
|
|
85
|
+
quantity: string;
|
|
86
|
+
sender: string;
|
|
87
|
+
recipient: string;
|
|
88
|
+
slippagePercent: string;
|
|
89
|
+
cosmosWalletName?: string | undefined;
|
|
90
|
+
}>;
|
|
91
|
+
|
|
92
|
+
export declare function injectStyles(css: string): void;
|
|
93
|
+
|
|
94
|
+
export declare const InterwovenKit: ({ bridge }: {
|
|
95
|
+
bridge?: Partial<FormValues>;
|
|
96
|
+
}) => JSX.Element;
|
|
97
|
+
|
|
98
|
+
export declare const InterwovenKitProvider: ({ children, ...config }: PropsWithChildren<Partial<Config>>) => JSX.Element | null;
|
|
99
|
+
|
|
100
|
+
export declare const MAINNET: Config;
|
|
101
|
+
|
|
102
|
+
declare interface Params {
|
|
103
|
+
restUrl: string;
|
|
104
|
+
moduleAddress: string;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export declare const TESTNET: Config;
|
|
108
|
+
|
|
109
|
+
export declare function toAmount(value?: BigNumber.Value, decimals?: number): string;
|
|
110
|
+
|
|
111
|
+
export declare function toQuantity(value?: BigNumber.Value, decimals?: number): string;
|
|
112
|
+
|
|
113
|
+
export declare function truncate(text?: string, [h, t]?: [number, number]): string;
|
|
114
|
+
|
|
115
|
+
declare interface TxRequest {
|
|
116
|
+
messages: EncodeObject[];
|
|
117
|
+
memo?: string;
|
|
118
|
+
chainId?: string;
|
|
119
|
+
gasAdjustment?: number;
|
|
120
|
+
gas?: number;
|
|
121
|
+
fee?: StdFee | null;
|
|
122
|
+
/** Internal use only */
|
|
123
|
+
internal?: boolean | string | number;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export declare function useAddress(): string;
|
|
127
|
+
|
|
128
|
+
export declare function useHexAddress(): string;
|
|
129
|
+
|
|
130
|
+
export declare function useInitiaAddress(): string;
|
|
131
|
+
|
|
132
|
+
export declare function useInterwovenKit(): {
|
|
133
|
+
estimateGas: ({ messages, memo, chainId }: TxRequest) => Promise<number>;
|
|
134
|
+
requestTxSync: (txRequest: TxRequest) => Promise<string>;
|
|
135
|
+
requestTxBlock: (txRequest: TxRequest) => Promise<DeliverTxResponse>;
|
|
136
|
+
waitForTxConfirmation: ({ chainId, ...params }: {
|
|
137
|
+
txHash: string;
|
|
138
|
+
chainId?: string;
|
|
139
|
+
timeoutSeconds?: number;
|
|
140
|
+
intervalSeconds?: number;
|
|
141
|
+
}) => Promise<IndexedTx>;
|
|
142
|
+
address: string;
|
|
143
|
+
initiaAddress: string;
|
|
144
|
+
hexAddress: string;
|
|
145
|
+
username: string | null | undefined;
|
|
146
|
+
openConnect: () => void;
|
|
147
|
+
openWallet: () => void;
|
|
148
|
+
openBridge: (defaultValues?: Partial<FormValues>) => void;
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
export declare function useUsernameQuery(): UseQueryResult<string | null, Error>;
|
|
152
|
+
|
|
153
|
+
export { }
|