@initia/interwovenkit-react 2.0.1 → 2.0.3

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 CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  InterwovenKit is a React library that provides components and hooks to connect dApps to Initia and Interwoven Rollups.
4
4
 
5
+ For detailed documentation, visit [https://docs.initia.xyz/interwovenkit](https://docs.initia.xyz/interwovenkit).
6
+
5
7
  ## Table of Contents
6
8
 
7
9
  - [Features](#features)
@@ -120,38 +122,27 @@ Connect the wallet, check the balance, and send a transaction:
120
122
  // page.tsx
121
123
  "use client"
122
124
 
123
- import { MsgSend } from "cosmjs-types/cosmos/bank/v1beta1/tx"
124
125
  import { truncate } from "@initia/utils"
125
126
  import { useInterwovenKit } from "@initia/interwovenkit-react"
126
127
 
127
128
  export default function Home() {
128
- const {
129
- address,
130
- username,
131
- openConnect,
132
- openWallet,
133
- openBridge,
134
- requestTxSync,
135
- waitForTxConfirmation,
136
- } = useInterwovenKit()
129
+ const { address, username, openConnect, openWallet, openBridge, requestTxBlock } =
130
+ useInterwovenKit()
137
131
 
138
132
  const send = async () => {
139
133
  const messages = [
140
134
  {
141
135
  typeUrl: "/cosmos.bank.v1beta1.MsgSend",
142
- value: MsgSend.fromPartial({
136
+ value: {
143
137
  fromAddress: address,
144
138
  toAddress: address,
145
139
  amount: [{ amount: "1000000", denom: "uinit" }],
146
- }),
140
+ },
147
141
  },
148
142
  ]
149
143
 
150
- const transactionHash = await requestTxSync({ messages })
144
+ const { transactionHash } = await requestTxBlock({ messages })
151
145
  console.log("Transaction sent:", transactionHash)
152
-
153
- await waitForTxConfirmation({ txHash: transactionHash })
154
- console.log("Transaction confirmed:", transactionHash)
155
146
  }
156
147
 
157
148
  const ETH = "move/edfcddacac79ab86737a1e9e65805066d8be286a37cb94f4884b892b0e39f954"
@@ -178,6 +169,42 @@ export default function Home() {
178
169
  }
179
170
  ```
180
171
 
172
+ ## Custom Fee Handling
173
+
174
+ When you need to bypass the fee selection UI and use pre-calculated fees directly:
175
+
176
+ ```tsx
177
+ // page.tsx
178
+ "use client"
179
+
180
+ import { calculateFee, GasPrice } from "@cosmjs/stargate"
181
+ import { useInterwovenKit } from "@initia/interwovenkit-react"
182
+
183
+ export default function Home() {
184
+ const { address, estimateGas, submitTxBlock } = useInterwovenKit()
185
+
186
+ const send = async () => {
187
+ const messages = [
188
+ {
189
+ typeUrl: "/cosmos.bank.v1beta1.MsgSend",
190
+ value: {
191
+ fromAddress: address,
192
+ toAddress: address,
193
+ amount: [{ amount: "1000000", denom: "uinit" }],
194
+ },
195
+ },
196
+ ]
197
+
198
+ const gas = await estimateGas({ messages })
199
+ const fee = calculateFee(gas, GasPrice.fromString("0.015uinit"))
200
+ const { transactionHash } = await submitTxBlock({ messages, fee })
201
+ console.log("Transaction sent:", transactionHash)
202
+ }
203
+
204
+ return <button onClick={send}>Send</button>
205
+ }
206
+ ```
207
+
181
208
  ## Usage on Testnet
182
209
 
183
210
  ```tsx
@@ -193,4 +220,4 @@ export default function Providers({ children }: PropsWithChildren) {
193
220
 
194
221
  To migrate from `@initia/react-wallet-widget` v1.x to `@initia/interwovenkit-react`, see our official migration guide:
195
222
 
196
- [https://github.com/initia-labs/interwovenkit/blob/main/packages/interwovenkit-react/MIGRATION.md](https://github.com/initia-labs/interwovenkit/blob/main/packages/interwovenkit-react/MIGRATION.md)
223
+ [https://docs.initia.xyz/interwovenkit/migration](https://docs.initia.xyz/interwovenkit/migration)