@cosmwasm/ts-codegen 0.31.3 → 0.31.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/README.md +48 -0
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -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",
3
+ "version": "0.31.4",
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": "7605b218d5823ab79fd61a529790f88b82d367c5"
101
+ "gitHead": "4c207bade9c6e542e9fc4d29b60866f4d7ff1627"
102
102
  }