@initia/interwovenkit-react 2.0.2 → 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 +36 -0
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +10 -0
- package/dist/index.js +2524 -2426
- package/dist/styles.css +1 -1
- package/dist/styles.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -169,6 +169,42 @@ export default function Home() {
|
|
|
169
169
|
}
|
|
170
170
|
```
|
|
171
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
|
+
|
|
172
208
|
## Usage on Testnet
|
|
173
209
|
|
|
174
210
|
```tsx
|