Skip to content

Commit 3b4b0c7

Browse files
golobitchmkurapov
andauthored
feat(wallet-address)!: possibility to specify wallet address range (#3325)
* feat(graphql): schema update for specifying settings when creating tenant * feat(tenant): add possibility to specify initial tenant settings as an operator * test(tenant): create with settings * feat(wallet-address): rename url to address * fix(tenant-settings): duplicate key for tenant * feat(wallet-address): replace url field with address field url field was replaced with address field, because now with range in wallet address, it is possible for the caller, to specify just the portion of the wallet address url. There is no need to specify the whole url in order to create wallet address. #3278 * chore(backend): format * fix(tests): some of them * fix(frontend): due to wallet address url change * fix(mase): due to wallet address url change * fix(backend): tests due to wallet address url change * test(integration): fix tests and have default address for operator * fix(wallet-address): test for operator can perform cross tenant create@ * test(tenant-settings): remove pagination tests for tenant settings * docs(bruno): rename of the walletaddress url variable * test(wallet-address): create with tenant settings or not as an operator or not * feat(wallet-address): put creation of it into new function * chore(format): everything * feat(tenant-settings): add tests for upsert * feat(tenant-settings): add more tests and remove pagination * Update packages/backend/src/open_payments/wallet_address/service.ts Co-authored-by: Max Kurapov <[email protected]> * Update packages/backend/src/graphql/resolvers/tenant_settings.ts Co-authored-by: Max Kurapov <[email protected]> * Update packages/backend/src/graphql/schema.graphql Co-authored-by: Max Kurapov <[email protected]> * chore(graphql): generate schema * fix(tenant): mapping settings to tenant * chore(graphql): generate schema --------- Co-authored-by: Max Kurapov <[email protected]>
1 parent 3258f8c commit 3b4b0c7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+880
-749
lines changed

bruno/collections/Rafiki/Rafiki Admin APIs/Create Wallet Address.bru

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ meta {
55
}
66

77
post {
8-
url: {{RafikiGraphqlHost}}/graphql
8+
address: {{RafikiGraphqlHost}}/graphql
99
body: graphql
1010
auth: none
1111
}
@@ -17,7 +17,7 @@ body:graphql {
1717
id
1818
createdAt
1919
publicName
20-
url
20+
address
2121
status
2222
asset {
2323
code
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
meta {
2+
name: Get Tenant Settings
3+
type: graphql
4+
seq: 60
5+
}
6+
7+
post {
8+
url: {{RafikiGraphqlHost}}/graphql
9+
body: graphql
10+
auth: none
11+
}
12+
13+
headers {
14+
tenant-id: 438fa74a-fa7d-4317-9ced-dde32ece1787
15+
}
16+
17+
body:graphql {
18+
mutation CreateTenantSettings($input: CreateTenantSettingsInput!) {
19+
createTenantSettings(input:$input) {
20+
settings {
21+
key
22+
value
23+
}
24+
}
25+
}
26+
}
27+
28+
body:graphql:vars {
29+
{
30+
"input": {
31+
"settings": [
32+
{ "key": "EXCHANGE_RATES_URL", "value": "https://example.com" }
33+
]
34+
}
35+
}
36+
37+
}
38+
39+
script:pre-request {
40+
const scripts = require('./scripts');
41+
42+
scripts.addApiSignatureHeader();
43+
}

bruno/collections/Rafiki/Rafiki Admin APIs/Get Wallet Addresses Keys.bru

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ body:graphql {
1818
node {
1919
id
2020
publicName
21-
url
21+
address
2222
walletAddressKeys {
2323
edges {
2424
cursor

bruno/collections/Rafiki/Rafiki Admin APIs/Get Wallet Addresses.bru

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ body:graphql {
1818
node {
1919
id
2020
publicName
21-
url
21+
address
2222
}
2323
}
2424
}

localenv/mock-account-servicing-entity/app/lib/requesters.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,15 @@ export async function createWalletAddress(
8888
createWalletAddress(input: $input) {
8989
walletAddress {
9090
id
91-
url
91+
address
9292
publicName
9393
}
9494
}
9595
}
9696
`
9797
const createWalletAddressInput: CreateWalletAddressInput = {
9898
assetId,
99-
url: accountUrl,
99+
address: accountUrl,
100100
publicName: accountName,
101101
additionalProperties: []
102102
}

localenv/mock-account-servicing-entity/app/lib/wallet.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export async function createWallet({
2525
await mockAccounts.setWalletAddress(
2626
accountId,
2727
walletAddress.id,
28-
walletAddress.url
28+
walletAddress.address
2929
)
3030

3131
await createWalletAddressKey({

localenv/mock-account-servicing-entity/app/lib/webhooks.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ export async function handleWalletAddressNotFound(wh: Webhook) {
277277
await mockAccounts.setWalletAddress(
278278
account.id,
279279
walletAddress.id,
280-
walletAddress.url
280+
walletAddress.address
281281
)
282282
}
283283

localenv/mock-account-servicing-entity/generated/graphql.ts

Lines changed: 9 additions & 50 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* @param { import("knex").Knex } knex
3+
* @returns { Promise<void> }
4+
*/
5+
exports.up = function (knex) {
6+
return knex.schema.alterTable('walletAddresses', (table) => {
7+
table.renameColumn('url', 'address')
8+
})
9+
}
10+
11+
/**
12+
* @param { import("knex").Knex } knex
13+
* @returns { Promise<void> }
14+
*/
15+
exports.down = function (knex) {
16+
return knex.schema.alterTable('walletAddresses', (table) => {
17+
table.renameColumn('address', 'url')
18+
})
19+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* @param { import("knex").Knex } knex
3+
* @returns { Promise<void> }
4+
*/
5+
exports.up = function (knex) {
6+
return knex.schema.alterTable('tenantSettings', function (table) {
7+
table.unique(['tenantId', 'key'])
8+
})
9+
}
10+
11+
/**
12+
* @param { import("knex").Knex } knex
13+
* @returns { Promise<void> }
14+
*/
15+
exports.down = function (knex) {
16+
return knex.schema.alterTable('tenantSettings', function (table) {
17+
table.dropUnique(['tenantId', 'key'])
18+
})
19+
}

0 commit comments

Comments
 (0)