Skip to content

Commit 94c8063

Browse files
committed
Using old version of GoodDollar SDK, new version doesn't have documentation
1 parent 22c5457 commit 94c8063

File tree

4 files changed

+21
-23
lines changed

4 files changed

+21
-23
lines changed

packages/nextjs-app/app/[lang]/[pathPrefix]/[pathSuffix]/page.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
"use client"
22

33
import axios from 'axios'
4-
5-
import { ClaimSDK, IdentitySDK } from '@goodsdks/citizen-sdk'
4+
import { ClaimSDK, useIdentitySDK } from '@goodsdks/citizen-sdk'
65
import { type PublicClient, type WalletClient } from 'viem'
76
import { useSession, getCsrfToken } from "next-auth/react"
87
import { use, useEffect, useState, useCallback } from 'react'
@@ -236,12 +235,7 @@ export default function Page({params} : {
236235
const publicClient = usePublicClient()
237236
const { data: walletClient } = useWalletClient()
238237
const identitySDK = process.env.NEXT_PUBLIC_AUTH_URL == "https://learn.tg" ?
239-
new IdentitySDK({
240-
env: 'production',
241-
publicClient: publicClient as PublicClient,
242-
walletClient: walletClient as WalletClient
243-
}) :
244-
null
238+
useIdentitySDK('production') : null;
245239

246240
const claimUBI = async () => {
247241
if (!session || !address || session.address != address ||
@@ -260,8 +254,10 @@ export default function Page({params} : {
260254
try {
261255
await claimSDK.claim()
262256
console.log('Claim successful')
257+
alert('Claim successful')
263258
} catch (error) {
264259
console.error('Claim failed:', error)
260+
alert('Claim failed:'+ JSON.stringify(error))
265261
}
266262
}
267263

packages/nextjs-app/app/api/scholarship/route.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,20 @@ export async function GET(req: NextRequest) {
1919
let retMessage = "";
2020
let md2 = "";
2121
if (process.env.NEXT_PUBLIC_AUTH_URL == undefined) {
22-
retMessage = "\nNEXT_PUBLIC_AUTH_URL undefined"
22+
retMessage += "\nNEXT_PUBLIC_AUTH_URL undefined"
2323
}
2424
if (process.env.NEXT_PUBLIC_DEPLOYED_AT == undefined) {
25-
retMessage = "\nNEXT_PUBLIC_DEPLOYED_AT undefined"
25+
retMessage += "\nNEXT_PUBLIC_DEPLOYED_AT undefined"
2626
}
2727
if (process.env.NEXT_PUBLIC_PRIVATE_KEY == undefined) {
28-
retMessage = "\nNEXT_PUBLIC_PRIVATE_KEY undefined"
28+
retMessage += "\nNEXT_PUBLIC_PRIVATE_KEY undefined"
2929
}
3030
if (process.env.NEXT_PUBLIC_RPC_URL == undefined) {
31-
retMessage = "\nNEXT_PUBLIC_RPC_URL undefined"
31+
retMessage += "\nNEXT_PUBLIC_RPC_URL undefined"
3232
}
3333
let usdtDecimals = 0
3434
if (process.env.NEXT_PUBLIC_USDT_DECIMALS == undefined) {
35-
retMessage = "\nNEXT_PUBLIC_USDT_DECIMALS undefined"
35+
retMessage += "\nNEXT_PUBLIC_USDT_DECIMALS undefined"
3636
} else {
3737
usdtDecimals = +process.env.NEXT_PUBLIC_USDT_DECIMALS
3838
}
@@ -121,11 +121,13 @@ export async function GET(req: NextRequest) {
121121
celo : celoSepolia,
122122
transport: http(rpcUrl)
123123
}) : undefined
124+
console.log("** walletClient=", walletClient)
124125
if (walletClient) {
125126
console.log("** walletClient creado")
126127
}
127128

128129
const contractAddress = process.env.NEXT_PUBLIC_DEPLOYED_AT as Address
130+
console.log("** contractAddress=", contractAddress)
129131
if (!contractAddress) {
130132
retMessage += "\nMissing contract address"
131133
} else if (walletClient) {

packages/nextjs-app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
},
1414
"dependencies": {
1515
"@divvi/referral-sdk": "^2.3.0",
16-
"@goodsdks/citizen-sdk": "^1.2.1",
16+
"@goodsdks/citizen-sdk": "1.0.1",
1717
"@radix-ui/react-accordion": "^1.2.12",
1818
"@radix-ui/react-alert-dialog": "^1.1.15",
1919
"@radix-ui/react-avatar": "^1.1.10",

packages/nextjs-app/pnpm-lock.yaml

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)