Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion incoming-payment/incoming-payment-create.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@ const client = await createAuthenticatedClient({
keyId: KEY_ID,
});

const walletAddress = await client.walletAddress.get({
url: WALLET_ADDRESS,
});

const incomingPayment = await client.incomingPayment.create(
{
url: new URL(WALLET_ADDRESS).origin,
url: walletAddress.resourceServer,
accessToken: INCOMING_PAYMENT_ACCESS_TOKEN,
},
{
Expand Down
18 changes: 12 additions & 6 deletions incoming-payment/incoming-payment-create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,16 @@ const client = await createAuthenticatedClient({
});
//@! end chunk 2

//@! start chunk 3 | title=Create incoming payment
//@! start chunk 3 | title=Get wallet address information
const walletAddress = await client.walletAddress.get({
url: WALLET_ADDRESS,
});
//@! end chunk 3

//@! start chunk 4 | title=Create incoming payment
const incomingPayment = await client.incomingPayment.create(
{
url: new URL(WALLET_ADDRESS).origin,
url: walletAddress.resourceServer,
accessToken: INCOMING_PAYMENT_ACCESS_TOKEN,
},
{
Expand All @@ -39,8 +45,8 @@ const incomingPayment = await client.incomingPayment.create(
expiresAt: new Date(Date.now() + 60_000 * 10).toISOString(),
},
);
//@! end chunk 3

//@! start chunk 4 | title=Output
console.log("INCOMING PAYMENT URL =", incomingPayment.id);
//@! end chunk 4

//@! start chunk 5 | title=Output
console.log("INCOMING_PAYMENT_URL =", incomingPayment.id);
//@! end chunk 5
6 changes: 5 additions & 1 deletion incoming-payment/incoming-payment-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@ const client = await createAuthenticatedClient({
keyId: KEY_ID,
});

const walletAddress = await client.walletAddress.get({
url: WALLET_ADDRESS,
});

const incomingPayments = await client.incomingPayment.list(
{
url: new URL(WALLET_ADDRESS).origin,
url: walletAddress.resourceServer,
walletAddress: WALLET_ADDRESS,
accessToken: INCOMING_PAYMENT_ACCESS_TOKEN,
},
Expand Down
13 changes: 10 additions & 3 deletions incoming-payment/incoming-payment-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,28 @@ const client = await createAuthenticatedClient({
});
//@! end chunk 2

//@! start chunk 3 | title=List incoming payments
//@! start chunk 3 | title=Get wallet address information
const walletAddress = await client.walletAddress.get({
url: WALLET_ADDRESS,
});
//@! end chunk 3

//@! start chunk 4 | title=List incoming payments
const incomingPayments = await client.incomingPayment.list(
{
url: new URL(WALLET_ADDRESS).origin,
url: walletAddress.resourceServer,
walletAddress: WALLET_ADDRESS,
accessToken: INCOMING_PAYMENT_ACCESS_TOKEN,
},
{
first: 10,
last: undefined,
cursor: undefined,
"wallet-address": WALLET_ADDRESS,
},
);
//@! end chunk 3

//@! start chunk 4 | title=Output
//@! start chunk 5 | title=Output
console.log("INCOMING PAYMENTS:", JSON.stringify(incomingPayments, null, 2));
//@! end chunk 4
6 changes: 5 additions & 1 deletion outgoing-payment/outgoing-payment-create.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@ const client = await createAuthenticatedClient({
keyId: KEY_ID,
});

const walletAddress = await client.walletAddress.get({
url: WALLET_ADDRESS,
});

const outgoingPayment = await client.outgoingPayment.create(
{
url: new URL(WALLET_ADDRESS).origin,
url: walletAddress.resourceServer,
accessToken: OUTGOING_PAYMENT_ACCESS_TOKEN,
},
{
Expand Down
16 changes: 11 additions & 5 deletions outgoing-payment/outgoing-payment-create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,25 @@ const client = await createAuthenticatedClient({
});
//@! end chunk 2

//@! start chunk 3 | title=Create outgoing payment
//@! start chunk 3 | title=Get wallet address information
const walletAddress = await client.walletAddress.get({
url: WALLET_ADDRESS,
});
//@! end chunk 3

//@! start chunk 4 | title=Create outgoing payment
const outgoingPayment = await client.outgoingPayment.create(
{
url: new URL(WALLET_ADDRESS).origin,
url: walletAddress.resourceServer,
accessToken: OUTGOING_PAYMENT_ACCESS_TOKEN,
},
{
walletAddress: WALLET_ADDRESS,
quoteId: QUOTE_URL,
},
);
//@! end chunk 3
//@! end chunk 4

//@! start chunk 4 | title=Output
//@! start chunk 5 | title=Output
console.log("OUTGOING_PAYMENT_URL = ", outgoingPayment.id);
//@! end chunk 4
//@! end chunk 5
6 changes: 5 additions & 1 deletion outgoing-payment/outgoing-payment-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@ const client = await createAuthenticatedClient({
keyId: KEY_ID,
});

const walletAddress = await client.walletAddress.get({
url: WALLET_ADDRESS,
});

const outgoingPayments = await client.outgoingPayment.list(
{
url: new URL(WALLET_ADDRESS).origin,
url: walletAddress.resourceServer,
walletAddress: WALLET_ADDRESS,
accessToken: OUTGOING_PAYMENT_ACCESS_TOKEN,
},
Expand Down
17 changes: 12 additions & 5 deletions outgoing-payment/outgoing-payment-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,28 @@ const client = await createAuthenticatedClient({
});
//@! end chunk 2

//@! start chunk 3 | title=List outgoing payments
//@! start chunk 3 | title=Get wallet address information
const walletAddress = await client.walletAddress.get({
url: WALLET_ADDRESS,
});
//@! end chunk 3

//@! start chunk 4 | title=List outgoing payments
const outgoingPayments = await client.outgoingPayment.list(
{
url: new URL(WALLET_ADDRESS).origin,
url: walletAddress.resourceServer,
walletAddress: WALLET_ADDRESS,
accessToken: OUTGOING_PAYMENT_ACCESS_TOKEN,
},
{
first: 10,
last: undefined,
cursor: undefined,
"wallet-address": WALLET_ADDRESS,
},
);
//@! end chunk 3
//@! end chunk 4

//@! start chunk 4 | title=Output
//@! start chunk 5 | title=Output
console.log("OUTGOING PAYMENTS:", JSON.stringify(outgoingPayments, null, 2));
//@! end chunk 4
//@! end chunk 5
2 changes: 1 addition & 1 deletion quote/quote-create-debit-amount.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const walletAddress = await client.walletAddress.get({

const quote = await client.quote.create(
{
url: new URL(WALLET_ADDRESS).origin,
url: walletAddress.resourceServer,
accessToken: QUOTE_ACCESS_TOKEN,
},
{
Expand Down
2 changes: 1 addition & 1 deletion quote/quote-create-debit-amount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const walletAddress = await client.walletAddress.get({
//@! start chunk 4 | title=Create quote with debit amount
const quote = await client.quote.create(
{
url: new URL(WALLET_ADDRESS).origin,
url: walletAddress.resourceServer,
accessToken: QUOTE_ACCESS_TOKEN,
},
{
Expand Down
2 changes: 1 addition & 1 deletion quote/quote-create-receive-amount.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const walletAddress = await client.walletAddress.get({

const quote = await client.quote.create(
{
url: new URL(WALLET_ADDRESS).origin,
url: walletAddress.resourceServer,
accessToken: QUOTE_ACCESS_TOKEN,
},
{
Expand Down
2 changes: 1 addition & 1 deletion quote/quote-create-receive-amount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const walletAddress = await client.walletAddress.get({
//@! start chunk 4 | title=Create quote with receive amount
const quote = await client.quote.create(
{
url: new URL(WALLET_ADDRESS).origin,
url: walletAddress.resourceServer,
accessToken: QUOTE_ACCESS_TOKEN,
},
{
Expand Down
6 changes: 5 additions & 1 deletion quote/quote-create.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@ const client = await createAuthenticatedClient({
keyId: KEY_ID,
});

const walletAddress = await client.walletAddress.get({
url: WALLET_ADDRESS,
});

const quote = await client.quote.create(
{
url: new URL(WALLET_ADDRESS).origin,
url: walletAddress.resourceServer,
accessToken: QUOTE_ACCESS_TOKEN,
},
{
Expand Down
16 changes: 11 additions & 5 deletions quote/quote-create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,16 @@ const client = await createAuthenticatedClient({
});
//@! end chunk 2

//@! start chunk 3 | title=Create quote
//@! start chunk 3 | title=Get wallet address information
const walletAddress = await client.walletAddress.get({
url: WALLET_ADDRESS,
});
//@! end chunk 3

//@! start chunk 4 | title=Create quote
const quote = await client.quote.create(
{
url: new URL(WALLET_ADDRESS).origin,
url: walletAddress.resourceServer,
accessToken: QUOTE_ACCESS_TOKEN,
},
{
Expand All @@ -36,8 +42,8 @@ const quote = await client.quote.create(
receiver: INCOMING_PAYMENT_URL,
},
);
//@! end chunk 3
//@! end chunk 4

//@! start chunk 4 | title=Output
//@! start chunk 5 | title=Output
console.log("QUOTE_URL =", quote.id);
//@! end chunk 4
//@! end chunk 5