Skip to content

Commit a5a664f

Browse files
committed
fix: align Peer Cash runtime contract
1 parent 50dbe6a commit a5a664f

4 files changed

Lines changed: 46 additions & 4 deletions

File tree

packages/peer-cash/README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ locked quotes. Call `fillStats()` before choosing a corridor; it returns
5757
```ts
5858
const prepared = await runtime.peerCash.prepareCashout({
5959
amountUsdc: '25',
60-
platform: 'wise',
60+
platform: 'revolut',
6161
currency: 'GBP',
62-
payee: 'recipient@example.com',
62+
payee: { offchainId: 'your-revtag' },
6363
});
6464

6565
// Host-owned wallet boundary. Inspect, sign, submit, and confirm each
@@ -79,6 +79,11 @@ if (prepared.accessPolicyRequired) {
7979
runtime, an account-abstraction wallet, an external signer, or another policy
8080
layer that can submit Base transactions.
8181

82+
Wise and PayPal require a verified identity for a new payee registration. Pass
83+
the structured `CashPayeeInput` returned by the host's identity-attestation
84+
flow; an already registered handle can still be reused as a string. The Peer
85+
Cash SDK validates this before any funds move on-chain.
86+
8287
## Resume and unwind
8388

8489
The composite `depositId` is the durable resume key:

packages/peer-cash/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
},
1010
"type": "module",
1111
"lucidAgents": {
12-
"runtime": "portable"
12+
"runtime": "node"
13+
},
14+
"engines": {
15+
"node": ">=22"
1316
},
1417
"main": "./dist/index.js",
1518
"module": "./dist/index.js",

packages/peer-cash/src/__tests__/peer-cash.test.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,39 @@ describe('peerCash', () => {
110110
expect(() => JSON.stringify(prepared)).not.toThrow();
111111
});
112112

113+
it('passes structured payee data through for attested payout identities', async () => {
114+
const baseClient = createCashClient({ environment: 'production' });
115+
let received: CashoutInput | undefined;
116+
const client = {
117+
...baseClient,
118+
prepare: async (input: CashoutInput) => {
119+
received = input;
120+
return prepareResultFromJson({
121+
txs: [],
122+
steps: [],
123+
register: { hashedOnchainIds: [] },
124+
accessPolicyRequired: false,
125+
});
126+
},
127+
} as CashClient;
128+
const agent = await createAgent({ name: 'cash-agent', version: '1.0.0' })
129+
.use(peerCash({ client }))
130+
.build();
131+
132+
await agent.peerCash.prepareCashout({
133+
amountUsdc: '25.5',
134+
platform: 'revolut',
135+
currency: 'gbp',
136+
payee: { offchainId: 'your-revtag' },
137+
});
138+
139+
expect(received?.receive).toMatchObject({
140+
platform: 'revolut',
141+
currency: 'GBP',
142+
payee: { offchainId: 'your-revtag' },
143+
});
144+
});
145+
113146
it('returns resumable order state as JSON', async () => {
114147
const depositId = '0x71e18f1b6a1c1a4dfa5c1728f5b70cf4a4d5c111_12';
115148
const baseClient = createCashClient({ environment: 'production' });

packages/peer-cash/src/peer-cash.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
type CashFillStatsJson,
1818
type CashOrderJson,
1919
type CashPreparedStepJson,
20+
type CashPayeeInput,
2021
type PrepareResultJson,
2122
type PreparedTransactionJson,
2223
type PreparedCashoutReceipt,
@@ -73,7 +74,7 @@ export type PeerCashoutInput = {
7374
amountUsdc: string;
7475
platform: string;
7576
currency: string;
76-
payee: string;
77+
payee: CashPayeeInput;
7778
minimumFillUsdc?: string;
7879
maximumFillUsdc?: string;
7980
};

0 commit comments

Comments
 (0)