Skip to content

Commit

Permalink
Add debug code
Browse files Browse the repository at this point in the history
  • Loading branch information
adairrr committed Jun 25, 2024
1 parent ac063e9 commit b016bf5
Show file tree
Hide file tree
Showing 11 changed files with 73 additions and 9 deletions.
8 changes: 8 additions & 0 deletions examples/wagemos-cosmoskit-nextjs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# wagemos-cosmoskit-nextjs

## 0.3.21

### Patch Changes

- Updated dependencies []:
- @abstract-money/react@1.3.8
- @abstract-money/provider-cosmoskit@5.0.8

## 0.3.20

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion examples/wagemos-cosmoskit-nextjs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wagemos-cosmoskit-nextjs",
"version": "0.3.20",
"version": "0.3.21",
"private": true,
"scripts": {
"dev": "next dev",
Expand Down
8 changes: 8 additions & 0 deletions examples/wagemos-graz-nextjs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# wagemos-graz-nextjs

## 0.3.21

### Patch Changes

- Updated dependencies []:
- @abstract-money/react@1.3.8
- @abstract-money/provider-graz@5.0.8

## 0.3.20

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion examples/wagemos-graz-nextjs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wagemos-graz-nextjs",
"version": "0.3.20",
"version": "0.3.21",
"private": true,
"scripts": {
"dev": "NODE_OPTIONS='--inspect' next dev",
Expand Down
7 changes: 7 additions & 0 deletions packages/provider-cosmoskit/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @abstract-money/provider-cosmoskit

## 5.0.8

### Patch Changes

- Updated dependencies []:
- @abstract-money/react@1.3.8

## 5.0.7

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/provider-cosmoskit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@abstract-money/provider-cosmoskit",
"version": "5.0.7",
"version": "5.0.8",
"description": "Provider for CosmosKit",
"homepage": "https://github.com/AbstractSDK/abstract.js#readme",
"author": "dalechyn <vlad@abstract.money>",
Expand Down
7 changes: 7 additions & 0 deletions packages/provider-graz/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @abstract-money/provider-graz

## 5.0.8

### Patch Changes

- Updated dependencies []:
- @abstract-money/react@1.3.8

## 5.0.7

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/provider-graz/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@abstract-money/provider-graz",
"version": "5.0.7",
"version": "5.0.8",
"description": "Provider for Graz",
"homepage": "https://github.com/AbstractSDK/abstract.js#readme",
"author": "dalechyn <vlad@abstract.money>",
Expand Down
6 changes: 6 additions & 0 deletions packages/react/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @abstract-money/react

## 1.3.8

### Patch Changes

- Adds debug code to the providers

## 1.3.7

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@abstract-money/react",
"version": "1.3.7",
"version": "1.3.8",
"description": "React Hooks for Abstract SDK",
"homepage": "https://github.com/AbstractSDK/abstract.js#readme",
"author": "dalechyn <vlad@abstract.money>",
Expand Down
36 changes: 32 additions & 4 deletions packages/react/src/create-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ export function createConfig(parameters: CreateConfigParameters) {
): PublicClient | undefined {
const cosmWasmClient = provider.useCosmWasmClient(...args)
return useMemo(() => {
if (!cosmWasmClient) return undefined
if (!cosmWasmClient) {
console.debug('usePublicClient: no cosmWasmClient')
return undefined
}
return createPublicClient({
apiUrl,
cosmWasmClient,
Expand All @@ -72,7 +75,13 @@ export function createConfig(parameters: CreateConfigParameters) {
const signingCosmWasmClient = provider.useSigningCosmWasmClient(...args)
const sender = provider.useSenderAddress(...args)
return useMemo(() => {
if (!signingCosmWasmClient || !sender) return undefined
if (!signingCosmWasmClient || !sender) {
console.debug('useWalletClient: no signingCosmWasmClient or sender', {
signingCosmWasmClient,
sender,
})
return undefined
}
return createWalletClient({
apiUrl,
sender,
Expand All @@ -91,7 +100,16 @@ export function createConfig(parameters: CreateConfigParameters) {
>): AccountPublicClient | undefined {
const cosmWasmClient = provider.useCosmWasmClient(rest)
return useMemo(() => {
if (!cosmWasmClient || !accountId) return undefined
if (!cosmWasmClient || !accountId) {
console.debug(
'useAccountPublicClient: no cosmWasmClient or accountId',
{
cosmWasmClient,
accountId,
},
)
return undefined
}
return createAccountPublicClient({
apiUrl,
cosmWasmClient,
Expand All @@ -111,7 +129,17 @@ export function createConfig(parameters: CreateConfigParameters) {
const signingCosmWasmClient = provider.useSigningCosmWasmClient(rest)
const sender = provider.useSenderAddress(rest)
return useMemo(() => {
if (!signingCosmWasmClient || !sender || !accountId) return undefined
if (!signingCosmWasmClient || !sender || !accountId) {
console.debug(
'useAccountWalletClient: no signingCosmWasmClient, sender, or accountId',
{
signingCosmWasmClient,
sender,
accountId,
},
)
return undefined
}
return createAccountWalletClient({
apiUrl,
sender,
Expand Down

0 comments on commit b016bf5

Please sign in to comment.