Skip to content

Commit

Permalink
feat(backend, frontend, auth, mock-ase): update open payments (#2075)
Browse files Browse the repository at this point in the history
* feat(backend): rename "payment pointer" tables & columns to use "wallet address" (#1937)

Co-authored-by: Nathan Lie <[email protected]>

* feat(backend, mock-ase): rename payment pointer to wallet address in rafiki code (#2029)

* fix(backend): rename paymentPointerId column in combinedPaymentsView to walletAddressId (#2043)

* docs: replace payment pointer with wallet address (#1951)

* feat(backend): remove connections route (#1940) (#2051)

Co-authored-by: Ömer Talha Özdemir <[email protected]>

* feat(backend): unauthenticated get incoming payment (#1952) (#2052)

Co-authored-by: Ömer Talha Özdemir <[email protected]>
Co-authored-by: Blair Currey <[email protected]>

* feat(auth): fix auth tests for access tokens (#2053)

* feat(backend): remove payment pointer from url, retrieve it from request query or body (#2042)

* refactor(backend): swap connection for methods (#2054)

Co-authored-by: Nathan Lie <[email protected]>

* fix(backend): resolve breaking build after main rebase (#2085)

* fix(backend): combined_payment, ilp service tests (#2094)

* fix(backend): combined_payment, ilp service tests

* chore(backend): format

* fix(backend): bad test refactor

* fix(postman): invalid json (#2096)

* fix: fetch walletAddress graph in quote and outgoing payment service (#2099)

* fix(postman): env var usage (#2107)

* feat(backend): add quotes route to exceptions in wallet address middleware (#2108)

* chore: formatting

* fix(backend): fix GET /incoming-payments (#2111)

* fix(backend): remove wallet address from OP response id and fix receiver service (#2115)

* fix: remove wallet address from op resource urls

* feat: return auth server url in public incoming payment and fix receiver service

* fix: quote issue

* fix: walletAddress middleware

* chore: update postman

* fix: listing

* chore: remove console.log

* fix: progress towards making listing work

* fix(backend): fix create remote incoming payment (#2121)

* fix(postman): misc postman fixes

* fix(postman): complete incoming payment (#2126)

* fix: file name correction (#2127)

* fix: GET resource lists, use op client (#2122)

* fix(postman): update list urls

* fix(openapi): rm defaults for first, last

* refactor(postman): query param order for readability

* fix(backend): update to new open-payments pkgs

* fix(backend): use op client to get authServer

* fix(backend): rm old code

* fix(backend): receiver tests

* chore: cleanup

* feat: make list query parameter configurable

* chore: update OP package and fix types

---------

Co-authored-by: Sabine Schaller <[email protected]>

* fix(postman): additional fixes

* fix: wallet address on the fly creation (#2129)

* chore: update postman environments

* Postman: update description for P2P example

* Postman: Remove finalizationReason from getGrants API + fix createWalletAddress

* chore: bump open-payments package in auth

* chore: update last few remaining mentions of payment pointers

* chore(postman): remove references to payment pointer

* chore: update another reference to pp

---------

Co-authored-by: Nathan Lie <[email protected]>
Co-authored-by: Ömer Talha Özdemir <[email protected]>
Co-authored-by: Blair Currey <[email protected]>
Co-authored-by: Sabine Schaller <[email protected]>
Co-authored-by: Sarah Jones <[email protected]>
Co-authored-by: Max Kurapov <[email protected]>
Co-authored-by: Max Kurapov <[email protected]>
  • Loading branch information
8 people authored Oct 26, 2023
1 parent 1845c53 commit 5ea0f7d
Show file tree
Hide file tree
Showing 170 changed files with 8,984 additions and 9,105 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ This includes

Rafiki is made up of several components, including an Interledger connector, a high-throughput accounting database called [TigerBeetle](https://rafiki.dev/concepts/accounting/tigerbeetle/), and several APIs:

- the [Admin API](https://rafiki.dev/apis/backend/schema/) to create [peering relationships](https://rafiki.dev/concepts/interledger-protocol/peering/), add supported [assets](https://rafiki.dev/concepts/asset/), and issue [payment pointers](https://rafiki.dev/reference/glossary/#payment-pointer)
- the [Admin API](https://rafiki.dev/apis/backend/schema/) to create [peering relationships](https://rafiki.dev/concepts/interledger-protocol/peering/), add supported [assets](https://rafiki.dev/concepts/asset/), and issue [wallet addresses](https://rafiki.dev/reference/glossary/#wallet-address)
- the [Open Payments](https://rafiki.dev/reference/glossary/#open-payments) API to allow third parties (with the account holder's consent) to initiate payments and to view the transaction history
- the [SPSP](https://rafiki.dev/reference/glossary/#simple-payments-setup-protocol-spsp) API for simple Interledger Payments

Expand All @@ -28,7 +28,6 @@ Never heard of Interledger before? Or would you like to learn more? Here are som
- [Interledger Website](https://interledger.org/)
- [Interledger Specs](https://interledger.org/rfcs/0027-interledger-protocol-4/)
- [Interledger Explainer Video](https://twitter.com/Interledger/status/1567916000074678272)
- [Payment pointers](https://paymentpointers.org/)
- [Open Payments](https://openpayments.guide/)
- [Web monetization](https://webmonetization.org/)

Expand Down
4 changes: 2 additions & 2 deletions infrastructure/helm/rafiki/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ rafiki-backend:
serviceUrls:
PUBLIC_HOST: http://rafiki-rafiki-backend
OPEN_PAYMENTS_URL: http://rafiki-rafiki-backend
PAYMENT_POINTER_URL: http://rafiki-rafiki-backend/.well-known/pay
WALLET_ADDRESS_URL: http://rafiki-rafiki-backend/.well-known/pay
WEBHOOK_URL: http://cloud-nine-wallet/webhooks
EXCHANGE_RATES_URL: http://cloud-nine-wallet/prices
AUTH_SERVER_GRANT_URL: http://rafiki-rafiki-auth:3006
Expand Down Expand Up @@ -41,7 +41,7 @@ rafiki-backend:
workers:
incomingPayment: 1
outgoingPayment: 4
paymentPointer: 1
walletAddress: 1
webhook: 1
workerIdle: 200
idempotency:
Expand Down
10 changes: 5 additions & 5 deletions localenv/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,11 @@ The exposed ports are 3000(open-payments), 3006(auth server), 3002(ilp connector
To use the postman collection examples follow the steps:

1. run `docker logs rafiki-cloud-nine-mock-ase-1`
2. find the list of created payment pointers
3. copy the url of one of the payment pointers
4. set the url into `senderPaymentPointer` postman variable in `Remote Environment`
2. find the list of created wallet addresses
3. copy the url of one of the wallet addresses
4. set the url into `senderWalletAddress` postman variable in `Remote Environment`

After stopping the script it is necessary to clear the environment using the command described in [Shutting down](#Shutting-down). This is necessary as on a new run of the scripts (with autopeeing or not) the payment pointer url will differ.
After stopping the script it is necessary to clear the environment using the command described in [Shutting down](#Shutting-down). This is necessary as on a new run of the scripts (with autopeering or not) the wallet address url will differ.

### Shutting down

Expand Down Expand Up @@ -193,7 +193,7 @@ In addition to the using the Admin UI for interacting with the Admin APIs, you c

#### SPSP

Every payment pointer also serves as an SPSP endpoint. A GET request to e.g. `http://localhost:3000/accounts/gfranklin` with `Accept` header `application/spsp4+json` will return an SPSP response with STREAM connection details.
Every wallet address also serves as an SPSP endpoint. A GET request to e.g. `http://localhost:3000/accounts/gfranklin` with `Accept` header `application/spsp4+json` will return an SPSP response with STREAM connection details.

```http
http GET http://localhost:3000/accounts/gfranklin Host:backend Accept:application/spsp4+json
Expand Down
2 changes: 1 addition & 1 deletion localenv/cloud-nine-wallet/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ services:
WEBHOOK_URL: http://cloud-nine-wallet/webhooks
EXCHANGE_RATES_URL: http://cloud-nine-wallet/rates
REDIS_URL: redis://shared-redis:6379/0
PAYMENT_POINTER_URL: ${CLOUD_NINE_PAYMENT_POINTER_URL:-https://cloud-nine-wallet-backend/.well-known/pay}
WALLET_ADDRESS_URL: ${CLOUD_NINE_WALLET_ADDRESS_URL:-https://cloud-nine-wallet-backend/.well-known/pay}
ILP_CONNECTOR_ADDRESS: ${CLOUD_NINE_CONNECTOR_URL}
depends_on:
- shared-database
Expand Down
6 changes: 3 additions & 3 deletions localenv/cloud-nine-wallet/seed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@ accounts:
path: accounts/gfranklin
id: 742ab7cd-1624-4d2e-af6e-e15a71638669
initialBalance: 4000
postmanEnvVar: gfranklinPaymentPointer
postmanEnvVar: gfranklinWalletAddress
assetCode: USD
- name: 'Bert Hamchest'
id: a9adbe1a-df31-4766-87c9-d2cb2e636a9b
initialBalance: 4000
path: accounts/bhamchest
postmanEnvVar: bhamchestPaymentPointer
postmanEnvVar: bhamchestWalletAddress
assetCode: USD
- name: "World's Best Donut Co"
id: 5726eefe-8737-459d-a36b-0acce152cb90
initialBalance: 2000
path: accounts/wbdc
postmanEnvVar: wbdcPaymentPointer
postmanEnvVar: wbdcWalletAddress
assetCode: USD
rates:
EUR:
Expand Down
48 changes: 24 additions & 24 deletions localenv/docs/peer-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -338,32 +338,32 @@ Example successful response:
}
```

### Create Payment Pointers to Send and Receive Payments
### Create Wallet Addresses to Send and Receive Payments

In this step we will provision payment pointers on the primary and secondary Rafiki instances.
Payment pointers are not accounts. Rafiki operators must supply their own "account servicing entity"
service for actually "holding" currency. Rafiki provides payment pointers--addresses within the
In this step we will provision wallet addresses on the primary and secondary Rafiki instances.
Wallet addresses are not accounts. Rafiki operators must supply their own "account servicing entity"
service for actually "holding" currency. Rafiki provides wallet addresses--addresses within the
ILP network to which other nodes on the network can send payments, which will then be routed
to the account servicing entity's system and into the appropriate account.

At the end of this step, we will have two payment pointer IDs: one provisioned on the primary
instance and one provisioned on the secondary instance. We will use these payment pointer IDs in
At the end of this step, we will have two wallet address IDs: one provisioned on the primary
instance and one provisioned on the secondary instance. We will use these wallet address IDs in
subsequent steps to send payments between the Rafiki instances.

#### On the Primary Instance

On the [primary instance](http://localhost:3001) execute the following command to create a payment
pointer ID:
On the [primary instance](http://localhost:3001) execute the following command to create a wallet
address ID:

Query

```
mutation CreatePaymentPointer ($input: CreateAccountInput!) {
createPaymentPointer(input: $input) {
mutation CreateWalletAddress ($input: CreateAccountInput!) {
createWalletAddress(input: $input) {
code
success
message
paymentPointer {
walletAddress {
id
asset {
id
Expand Down Expand Up @@ -392,11 +392,11 @@ Example successful response
```
{
"data": {
"createPaymentPointer": {
"createWalletAddress": {
"code": "200",
"success": true,
"message": "Created Account",
"paymentPointer": {
"walletAddress": {
"id": "afb2b1de-d819-4e85-b901-859c27445936",
"asset": {
"id": "5a27f8ec-17a5-4388-8d1e-8243d1926778",
Expand All @@ -412,18 +412,18 @@ Example successful response

#### On the Secondary Instance

On the [secondary instance](http://localhost:4001) execute the following command to create a payment
pointer ID:
On the [secondary instance](http://localhost:4001) execute the following command to create a wallet
address ID:

Query

```
mutation CreatePaymentPointer ($input: CreateAccountInput!) {
createPaymentPointer(input: $input) {
mutation CreateWalletAddress ($input: CreateAccountInput!) {
createWalletAddress(input: $input) {
code
success
message
paymentPointer {
walletAddress {
id
asset {
id
Expand Down Expand Up @@ -452,11 +452,11 @@ Example successful response
```
{
"data": {
"createPaymentPointer": {
"createWalletAddress": {
"code": "200",
"success": true,
"message": "Created Account",
"paymentPointer": {
"walletAddress": {
"id": "7e8b99f5-0861-49bd-95ab-e871c021d84d",
"asset": {
"id": "209fe717-bf02-4deb-826f-b7ed4f179713",
Expand All @@ -470,8 +470,8 @@ Example successful response
}
```

#### Note the Payment Pointer IDs
#### Note the Wallet Address IDs

The `data.createPaymentPointer.paymentPointer.id` field in the response is the payment pointer ID, which we will
use in the next steps. In this example, the primary payment pointer ID is `afb2b1de-d819-4e85-b901-859c27445936`,
and the secondary payment pointer ID is `7e8b99f5-0861-49bd-95ab-e871c021d84d`.
The `data.createWalletAddress.walletAddress.id` field in the response is the wallet address ID, which we will
use in the next steps. In this example, the primary wallet address ID is `afb2b1de-d819-4e85-b901-859c27445936`,
and the secondary wallet address ID is `7e8b99f5-0861-49bd-95ab-e871c021d84d`.
2 changes: 1 addition & 1 deletion localenv/happy-life-bank/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ services:
OPEN_PAYMENTS_URL: ${HAPPY_LIFE_BANK_OPEN_PAYMENTS_URL:-http://happy-life-bank-backend}
EXCHANGE_RATES_URL: http://happy-life-bank/rates
REDIS_URL: redis://shared-redis:6379/1
PAYMENT_POINTER_URL: ${HAPPY_LIFE_BANK_PAYMENT_POINTER_URL:-https://happy-life-bank-backend/.well-known/pay}
WALLET_ADDRESS_URL: ${HAPPY_LIFE_BANK_WALLET_ADDRESS_URL:-https://happy-life-bank-backend/.well-known/pay}
depends_on:
- cloud-nine-backend
happy-life-auth:
Expand Down
8 changes: 4 additions & 4 deletions localenv/happy-life-bank/seed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@ accounts:
path: accounts/pfry
id: 97a3a431-8ee1-48fc-ac85-70e2f5eba8e5
initialBalance: 1
postmanEnvVar: pfryPaymentPointer
postmanEnvVar: pfryWalletAddress
assetCode: USD
- name: 'PlanEx Corp'
id: a455cc54-b583-455b-836a-e5275c5c05b7
initialBalance: 2000
path: accounts/planex
postmanEnvVar: planexPaymentPointer
postmanEnvVar: planexWalletAddress
assetCode: USD
- name: 'Alice Smith'
path: accounts/asmith
id: f47ac10b-58cc-4372-a567-0e02b2c3d479
initialBalance: 500
postmanEnvVar: asmithPaymentPointer
skipPaymentPointerCreation: true
postmanEnvVar: asmithWalletAddress
skipWalletAddressCreation: true
assetCode: USD
- name: 'Lars'
path: accounts/lars
Expand Down
42 changes: 20 additions & 22 deletions localenv/mock-account-servicing-entity/app/lib/accounts.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ export interface Account {
id: string
name: string
path: string
paymentPointerID: string
paymentPointer: string
walletAddressID: string
walletAddress: string
debitsPending: bigint
debitsPosted: bigint
creditsPending: bigint
Expand All @@ -15,10 +15,10 @@ export interface Account {

export interface AccountsServer {
clearAccounts(): Promise<void>
setPaymentPointer(
setWalletAddress(
id: string,
pointerID: string,
paymentPointer: string
walletID: string,
walletAddress: string
): Promise<void>
create(
id: string,
Expand All @@ -30,11 +30,9 @@ export interface AccountsServer {
): Promise<void>
listAll(): Promise<Account[]>
get(id: string): Promise<Account | undefined>
getByPaymentPointerId(paymentPointerId: string): Promise<Account | undefined>
getByWalletAddressId(walletAddressId: string): Promise<Account | undefined>
getByPath(path: string): Promise<Account | undefined>
getByPaymentPointerUrl(
paymentPointerUrl: string
): Promise<Account | undefined>
getByWalletAddressUrl(walletAddressUrl: string): Promise<Account | undefined>
voidPendingDebit(id: string, amount: bigint): Promise<void>
voidPendingCredit(id: string, amount: bigint): Promise<void>
pendingDebit(id: string, amount: bigint): Promise<void>
Expand All @@ -50,10 +48,10 @@ export class AccountProvider implements AccountsServer {
this.accounts.clear()
}

async setPaymentPointer(
async setWalletAddress(
id: string,
pointerID: string,
paymentPointer: string
walletID: string,
walletAddress: string
): Promise<void> {
if (!this.accounts.has(id)) {
throw new Error('account already exists')
Expand All @@ -65,8 +63,8 @@ export class AccountProvider implements AccountsServer {
throw new Error()
}

acc.paymentPointer = paymentPointer
acc.paymentPointerID = pointerID
acc.walletAddress = walletAddress
acc.walletAddressID = walletID
}

async create(
Expand All @@ -84,8 +82,8 @@ export class AccountProvider implements AccountsServer {
id,
name,
path,
paymentPointer: '',
paymentPointerID: '',
walletAddress: '',
walletAddressID: '',
creditsPending: BigInt(0),
creditsPosted: BigInt(0),
debitsPending: BigInt(0),
Expand All @@ -104,21 +102,21 @@ export class AccountProvider implements AccountsServer {
return this.accounts.get(id)
}

async getByPaymentPointerId(
paymentPointerId: string
async getByWalletAddressId(
walletAddressId: string
): Promise<Account | undefined> {
for (const acc of this.accounts.values()) {
if (acc.paymentPointerID == paymentPointerId) {
if (acc.walletAddressID == walletAddressId) {
return acc
}
}
}

async getByPaymentPointerUrl(
paymentPointerUrl: string
async getByWalletAddressUrl(
walletAddressUrl: string
): Promise<Account | undefined> {
return (await this.listAll()).find(
(acc) => acc.paymentPointer === paymentPointerUrl
(acc) => acc.walletAddress === walletAddressUrl
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { mockAccounts } from './accounts.server'
export type AccountWithBalance = {
id: string
name: string
paymentPointerID: string
paymentPointer: string
walletAddressID: string
walletAddress: string
balance: string
assetCode: string
assetScale: number
Expand All @@ -18,8 +18,8 @@ export async function getAccountsWithBalance(): Promise<
return {
id: acc.id,
name: acc.name,
paymentPointerID: acc.paymentPointerID,
paymentPointer: acc.paymentPointer,
walletAddressID: acc.walletAddressID,
walletAddress: acc.walletAddress,
balance: (
BigInt(acc.creditsPosted) - BigInt(acc.debitsPosted)
).toString(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export interface Account {
path: string
postmanEnvVar: string
assetCode: string
skipPaymentPointerCreation?: boolean
skipWalletAddressCreation?: boolean
}

export interface Fee {
Expand Down
Loading

0 comments on commit 5ea0f7d

Please sign in to comment.