Skip to content

Commit fd722e5

Browse files
authored
Merge branch 'main' into 209-make-currencies-and-payment-chain-input-parameter-_override_-the-default-currency-and-payment-chains-list-instead-of-append
2 parents 9d66b5d + 9e36e9d commit fd722e5

File tree

11 files changed

+433
-866
lines changed

11 files changed

+433
-866
lines changed

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"packageManager": "npm@10.5.0",
3030
"dependencies": {
3131
"@changesets/cli": "^2.27.10",
32-
"@requestnetwork/currency": "0.21.0",
32+
"@requestnetwork/currency": "0.22.0",
3333
"bits-ui": "^0.21.12"
3434
}
3535
}

packages/create-invoice-form/CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# @requestnetwork/create-invoice-form
22

3+
## 0.11.10
4+
5+
### Patch Changes
6+
7+
- Fix enbable decryption
8+
9+
## 0.11.9
10+
11+
### Patch Changes
12+
13+
- Upgrade SDK to 0.53.0
14+
315
## 0.11.8
416

517
### Patch Changes

packages/create-invoice-form/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@requestnetwork/create-invoice-form",
3-
"version": "0.11.8",
3+
"version": "0.11.10",
44
"main": "./dist/web-component.umd.cjs",
55
"scripts": {
66
"dev": "vite dev",
@@ -33,8 +33,8 @@
3333
"!dist/**/*.spec.*"
3434
],
3535
"dependencies": {
36-
"@requestnetwork/data-format": "0.19.3",
37-
"@requestnetwork/request-client.js": "0.52.0",
36+
"@requestnetwork/data-format": "0.19.4",
37+
"@requestnetwork/request-client.js": "0.53.0",
3838
"@wagmi/core": "^2.15.2",
3939
"validator": "^13.12.0",
4040
"viem": "^2.21.53"

packages/create-invoice-form/src/lib/create-invoice-form.svelte

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
export let wagmiConfig: WagmiConfig;
3030
export let requestNetwork: RequestNetwork | null | undefined;
3131
export let currencies: CurrencyTypes.CurrencyInput[] = [];
32-
let cipherProvider: CipherProviderTypes.ICipherProvider | undefined = requestNetwork?.getCipherProvider();
32+
let cipherProvider: CipherProviderTypes.ICipherProvider | undefined;
3333
3434
let account: GetAccountReturnType;
3535
let isTimeout = false;
@@ -115,6 +115,8 @@
115115
totalAmount: 0,
116116
};
117117
118+
$: cipherProvider = requestNetwork?.getCipherProvider();
119+
118120
$: {
119121
if (wagmiConfig) {
120122
account = getAccount(wagmiConfig);

packages/invoice-dashboard/CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
# @requestnetwork/invoice-dashboard
22

3+
## 0.11.8
4+
5+
### Patch Changes
6+
7+
- Fix enbable decryption
8+
9+
## 0.11.7
10+
11+
### Patch Changes
12+
13+
- Fix InvoiceDashboardProps types
14+
15+
## 0.11.6
16+
17+
### Patch Changes
18+
19+
- Upgrade SDK to 0.53.0
20+
321
## 0.11.5
422

523
### Patch Changes

packages/invoice-dashboard/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@requestnetwork/invoice-dashboard",
3-
"version": "0.11.5",
3+
"version": "0.11.8",
44
"main": "./dist/web-component.umd.cjs",
55
"scripts": {
66
"dev": "vite dev",
@@ -37,9 +37,9 @@
3737
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
3838
},
3939
"dependencies": {
40-
"@requestnetwork/payment-detection": "0.47.0",
41-
"@requestnetwork/payment-processor": "0.50.0",
42-
"@requestnetwork/request-client.js": "0.52.0",
40+
"@requestnetwork/payment-detection": "0.48.0",
41+
"@requestnetwork/payment-processor": "0.51.0",
42+
"@requestnetwork/request-client.js": "0.53.0",
4343
"@wagmi/connectors": "^5.5.3",
4444
"@wagmi/core": "^2.15.2",
4545
"ethers": "^5.7.2",

packages/invoice-dashboard/src/lib/react/InvoiceDashboard.d.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ export interface InvoiceDashboardProps {
99
wagmiConfig: WagmiConfig;
1010
requestNetwork: RequestNetwork | null | undefined;
1111
currencies: CurrencyTypes.CurrencyInput[];
12-
isDecryptionEnabled: boolean;
13-
enableDecryption: (option: boolean) => void;
1412
}
1513
/**
1614
* InvoiceDashboard is a React component that integrates with the Request Network to manage and display invoices.

packages/invoice-dashboard/src/lib/view-requests.svelte

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,23 @@
4141
import { CurrencyManager } from "@requestnetwork/currency";
4242
import { onDestroy, onMount, tick } from "svelte";
4343
import { formatUnits } from "viem";
44-
import { debounce, formatAddress } from "../utils";
44+
import { debounce, formatAddress, getEthersSigner } from "../utils";
4545
import { Drawer, InvoiceView } from "./dashboard";
4646
import { getPaymentNetworkExtension } from "@requestnetwork/payment-detection";
4747
import { CipherProviderTypes, CurrencyTypes } from "@requestnetwork/types";
48-
import { checkStatus } from "@requestnetwork/shared-utils/checkStatus";
48+
import { checkStatus } from "@requestnetwork/shared-utils/checkStatus";
49+
import { ethers } from "ethers";
4950
5051
export let config: IConfig;
5152
export let wagmiConfig: WagmiConfig;
5253
export let requestNetwork: RequestNetwork | null | undefined;
5354
export let currencies: CurrencyTypes.CurrencyInput[] = [];
5455
55-
let cipherProvider: CipherProviderTypes.ICipherProvider | undefined = requestNetwork?.getCipherProvider();
56+
let cipherProvider: CipherProviderTypes.ICipherProvider & {
57+
getSessionSignatures: (signer: ethers.Signer, walletAddress: `0x${string}`) => Promise<any>;
58+
} | undefined;
5659
57-
let sliderValueForDecryption = cipherProvider?.isDecryptionEnabled() ? "on" : "off";
60+
let sliderValueForDecryption = JSON.parse(localStorage?.getItem('isDecryptionEnabled') ?? "false") ? "on" : "off";
5861
5962
let signer: `0x${string}` | undefined;
6063
let activeConfig = config ? config : defaultConfig;
@@ -99,6 +102,7 @@
99102
$: {
100103
if (account?.address) {
101104
tick().then(() => {
105+
enableDecryption();
102106
getRequests();
103107
});
104108
}
@@ -128,6 +132,13 @@
128132
if (typeof unwatchAccount === "function") unwatchAccount();
129133
});
130134
135+
$: cipherProvider = requestNetwork?.getCipherProvider() as CipherProviderTypes.ICipherProvider & {
136+
getSessionSignatures: (
137+
signer: ethers.Signer,
138+
walletAddress: `0x${string}`
139+
) => Promise<any>;
140+
};
141+
131142
$: {
132143
signer = account?.address;
133144
}
@@ -389,17 +400,31 @@
389400
const handleRemoveSelectedRequest = () => {
390401
activeRequest = undefined;
391402
};
392-
393403
394-
$: sliderValueForDecryption, getRequests();
395-
396-
$: {
404+
const enableDecryption = async () => {
405+
loading = true;
397406
if(sliderValueForDecryption === 'on') {
398-
cipherProvider?.enableDecryption(true);
407+
try {
408+
const signer = await getEthersSigner(wagmiConfig);
409+
if (signer && account?.address) {
410+
await cipherProvider?.getSessionSignatures(signer, account.address);
411+
cipherProvider?.enableDecryption(true);
412+
localStorage?.setItem('isDecryptionEnabled', JSON.stringify(true));
413+
}
414+
} catch (error) {
415+
console.error("Failed to enable decryption:", error);
416+
toast.error("Failed to enable decryption.");
417+
loading = false;
418+
return;
419+
}
399420
} else {
400421
cipherProvider?.enableDecryption(false);
422+
localStorage?.setItem('isDecryptionEnabled', JSON.stringify(false));
401423
}
424+
await getRequests();
425+
loading = false;
402426
}
427+
$: sliderValueForDecryption, enableDecryption();
403428
404429
</script>
405430

packages/payment-widget/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @requestnetwork/payment-widget
22

3+
## 0.3.6
4+
5+
### Patch Changes
6+
7+
- Upgrade SDK to 0.53.0
8+
39
## 0.3.5
410

511
### Patch Changes

0 commit comments

Comments
 (0)