diff --git a/package.json b/package.json index bc71a37..54e2a15 100644 --- a/package.json +++ b/package.json @@ -68,4 +68,4 @@ "typescript": "^5.6.3", "zustand": "^4.5.2" } -} +} \ No newline at end of file diff --git a/src/deeplink/index.ts b/src/deeplink/index.ts index 6d8446d..b18b923 100644 --- a/src/deeplink/index.ts +++ b/src/deeplink/index.ts @@ -20,22 +20,3 @@ export const generateLegacyReceiveLink = ( return `${baseUrl}/#/?alias=${alias}&receiveParams=${compressedParams}`; }; - -export const generateReceiveLink = ( - baseUrl: string, - account: string, - alias: string, - amount?: string, - description?: string -): string => { - let url = `${baseUrl}/?sendto=${account}@${alias}`; - if (amount) { - url += `&amount=${amount}`; - } - - if (description) { - url += `&description=${encodeURIComponent(description)}`; - } - - return url; -}; diff --git a/src/index.ts b/src/index.ts index 4e753c1..7a452ed 100644 --- a/src/index.ts +++ b/src/index.ts @@ -8,3 +8,5 @@ export * from "./ipfs"; export * from "./vouchers"; export * from "./deeplink"; export * from "./accounts"; +export * from "./receive"; +export * from "./transactions"; diff --git a/src/receive/index.ts b/src/receive/index.ts new file mode 100644 index 0000000..22be4d3 --- /dev/null +++ b/src/receive/index.ts @@ -0,0 +1,18 @@ +export const generateReceiveLink = ( + baseUrl: string, + account: string, + alias: string, + amount?: string, + description?: string +): string => { + let url = `${baseUrl}/?sendto=${account}@${alias}`; + if (amount) { + url += `&amount=${amount}`; + } + + if (description) { + url += `&description=${encodeURIComponent(description)}`; + } + + return url; +}; diff --git a/src/transactions/index.ts b/src/transactions/index.ts new file mode 100644 index 0000000..790192d --- /dev/null +++ b/src/transactions/index.ts @@ -0,0 +1,21 @@ +import { CommunityConfig } from "../index.ts"; +import { JsonRpcProvider } from "ethers"; + +export const waitForTxSuccess = async ( + config: CommunityConfig, + txHash: string +): Promise => { + try { + const rpc = new JsonRpcProvider(config.primaryRPCUrl); + + const receipt = await rpc.waitForTransaction(txHash); + if (!receipt) { + throw new Error("Transaction not found"); + } + + return receipt.status === 1; + } catch (error) { + console.error("Error waiting for transaction:", error); + return false; + } +};