@cosmwasm/ts-codegen 0.31.3 → 0.31.5
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 +51 -3
- package/package.json +2 -2
package/README.md
CHANGED
@@ -275,9 +275,9 @@ cosmwasm-ts-codegen generate \
|
|
275
275
|
```
|
276
276
|
#### Message Builder Options
|
277
277
|
|
278
|
-
| option
|
279
|
-
|
280
|
-
| `msgBuilder.enabled` | enable the msgBuilder plugin
|
278
|
+
| option | description |
|
279
|
+
|--------------------- | ------------------------------ |
|
280
|
+
| `msgBuilder.enabled` | enable the msgBuilder plugin |
|
281
281
|
|
282
282
|
|
283
283
|
### Use Contracts Hooks
|
@@ -286,6 +286,54 @@ cosmwasm-ts-codegen generate \
|
|
286
286
|
| -------------------------------- | --------------------------------------- |
|
287
287
|
| `useContractsHooks.enabled` | enable the `useContracts` plugin |
|
288
288
|
|
289
|
+
#### Use Contracts Provider Usage
|
290
|
+
|
291
|
+
```tsx
|
292
|
+
import { useChain } from '@cosmos-kit/react';
|
293
|
+
import { ContractsProvider } from '../path/to/codegen/contracts-context';
|
294
|
+
|
295
|
+
export default function YourComponent() {
|
296
|
+
|
297
|
+
const {
|
298
|
+
address,
|
299
|
+
getCosmWasmClient,
|
300
|
+
getSigningCosmWasmClient
|
301
|
+
} = useChain(chainName);
|
302
|
+
|
303
|
+
return (
|
304
|
+
<ContractsProvider
|
305
|
+
contractsConfig={{
|
306
|
+
address,
|
307
|
+
getCosmWasmClient,
|
308
|
+
getSigningCosmWasmClient,
|
309
|
+
}}
|
310
|
+
>
|
311
|
+
<SomeCoolComponent />
|
312
|
+
</ContractsProvider>
|
313
|
+
)
|
314
|
+
};
|
315
|
+
```
|
316
|
+
|
317
|
+
#### Use Contracts Hooks Usage
|
318
|
+
|
319
|
+
Once enabled, you can get contracts very simply:
|
320
|
+
|
321
|
+
```ts
|
322
|
+
const { marketplace } = useContracts();
|
323
|
+
```
|
324
|
+
|
325
|
+
```ts
|
326
|
+
const marketplaceClient = marketplace.signingClient(marketplaceContract);
|
327
|
+
await marketplaceClient.updateAskPrice({
|
328
|
+
collection: token.collectionAddr,
|
329
|
+
price: {
|
330
|
+
amount,
|
331
|
+
denom,
|
332
|
+
},
|
333
|
+
tokenId,
|
334
|
+
});
|
335
|
+
```
|
336
|
+
|
289
337
|
### Bundles
|
290
338
|
|
291
339
|
The bundler will make a nice package of all your contracts. For example:
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@cosmwasm/ts-codegen",
|
3
|
-
"version": "0.31.
|
3
|
+
"version": "0.31.5",
|
4
4
|
"description": "@cosmwasm/ts-codegen converts your CosmWasm smart contracts into dev-friendly TypeScript classes so you can focus on shipping code.",
|
5
5
|
"author": "Dan Lynch <pyramation@gmail.com>",
|
6
6
|
"homepage": "https://github.com/cosmwasm/ts-codegen",
|
@@ -98,5 +98,5 @@
|
|
98
98
|
"shelljs": "0.8.5",
|
99
99
|
"wasm-ast-types": "^0.24.0"
|
100
100
|
},
|
101
|
-
"gitHead": "
|
101
|
+
"gitHead": "f678de3cce2ad0dc29f5ad9d6154831bd74ed2a6"
|
102
102
|
}
|