Skip to content

Commit 005e455

Browse files
authored
clarify outgoing payment grant request (#50)
1 parent 5011773 commit 005e455

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

grant/grant-outgoing-payment.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ const quote = await client.quote.get({
3131
accessToken: QUOTE_ACCESS_TOKEN,
3232
});
3333

34-
const DEBIT_AMOUNT = quote.debitAmount;
35-
const RECEIVE_AMOUNT = quote.receiveAmount;
36-
3734
const grant = await client.grant.request(
3835
{
3936
url: walletAddress.authServer,
@@ -46,8 +43,11 @@ const grant = await client.grant.request(
4643
type: "outgoing-payment",
4744
actions: ["list", "list-all", "read", "read-all", "create"],
4845
limits: {
49-
debitAmount: DEBIT_AMOUNT,
50-
receiveAmount: RECEIVE_AMOUNT,
46+
debitAmount: {
47+
assetCode: quote.debitAmount.assetCode,
48+
assetScale: quote.debitAmount.assetScale,
49+
value: quote.debitAmount.value
50+
}
5151
},
5252
},
5353
],

grant/grant-outgoing-payment.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ const quote = await client.quote.get({
3737
accessToken: QUOTE_ACCESS_TOKEN,
3838
});
3939

40-
const DEBIT_AMOUNT = quote.debitAmount;
41-
const RECEIVE_AMOUNT = quote.receiveAmount;
4240

4341
//@! start chunk 4 | title=Request outgoing payment grant
4442
const grant = await client.grant.request(
@@ -53,8 +51,11 @@ const grant = await client.grant.request(
5351
type: "outgoing-payment",
5452
actions: ["list", "list-all", "read", "read-all", "create"],
5553
limits: {
56-
debitAmount: DEBIT_AMOUNT,
57-
receiveAmount: RECEIVE_AMOUNT,
54+
debitAmount: {
55+
assetCode: quote.debitAmount.assetCode,
56+
assetScale: quote.debitAmount.assetScale,
57+
value: quote.debitAmount.value
58+
}
5859
},
5960
},
6061
],

0 commit comments

Comments
 (0)