@peable.to/contracts 5.6.0 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/resources/payments/social.js +72 -6
- package/dist/cjs/vocabulary/errors.js +1 -2
- package/dist/cjs/vocabulary/index.js +0 -1
- package/dist/cjs/vocabulary/payments.js +9 -3
- package/dist/esm/resources/payments/social.js +72 -6
- package/dist/esm/vocabulary/errors.js +1 -2
- package/dist/esm/vocabulary/index.js +0 -1
- package/dist/esm/vocabulary/payments.js +8 -2
- package/dist/types/resources/payments/index.d.ts +31 -1
- package/dist/types/resources/payments/social.d.ts +82 -5
- package/dist/types/vocabulary/errors.d.ts +1 -2
- package/dist/types/vocabulary/index.d.ts +0 -1
- package/dist/types/vocabulary/payments.d.ts +8 -2
- package/package.json +1 -1
- package/dist/cjs/vocabulary/receiveTree.js +0 -44
- package/dist/esm/vocabulary/receiveTree.js +0 -41
- package/dist/types/vocabulary/receiveTree.d.ts +0 -41
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.socialRoutes = exports.enrichSchema = exports.enrichParams = exports.socialPaymentsSchema = exports.socialPaymentSchema = exports.socialPaymentsQuery = exports.socialReceiveCursorSchema = exports.socialReceiveCursorQuery = exports.socialNextAddressSchema = exports.socialNextAddressParams = exports.socialPaymentSourceParams = exports.enrichmentResultSchema = exports.socialPaymentSourceSchema = void 0;
|
|
3
|
+
exports.socialRoutes = exports.enrichSchema = exports.enrichParams = exports.socialPaymentsSchema = exports.socialPaymentSchema = exports.socialPaymentsQuery = exports.socialReceiveAddressesSchema = exports.socialReceiveAddressSchema = exports.socialReceiveAddressesQuery = exports.socialReceiveCursorSchema = exports.socialReceiveCursorQuery = exports.socialNextAddressSchema = exports.socialNextAddressParams = exports.socialPaymentSourceParams = exports.enrichmentResultSchema = exports.socialPaymentSourceSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const objects_1 = require("../../common/objects");
|
|
6
|
+
const params_1 = require("../../common/params");
|
|
7
|
+
/** The highest BIP32 non-hardened child index, `int4`'s ceiling (`schema/valueSets.ts`). */
|
|
8
|
+
const MAX_DERIVATION_INDEX = 2147483647;
|
|
6
9
|
const primitives_1 = require("../../common/primitives");
|
|
7
10
|
const route_1 = require("../../route");
|
|
8
11
|
const payments_1 = require("../../vocabulary/payments");
|
|
@@ -86,10 +89,10 @@ exports.socialNextAddressSchema = (0, objects_1.defineComponent)('SocialNextAddr
|
|
|
86
89
|
const networkQuery = zod_1.z.object({ network: primitives_1.network });
|
|
87
90
|
exports.socialReceiveCursorQuery = networkQuery;
|
|
88
91
|
/**
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
92
|
+
* The caller's cursor and keys. The addresses to watch are
|
|
93
|
+
* `GET /v1/social/me/receive_addresses` (ADR 0021 D9, amended 2026-11-06);
|
|
94
|
+
* `reserved_through` only says how far the cursor went, and the device
|
|
95
|
+
* compares its key with `account_identity_public_key`.
|
|
93
96
|
*/
|
|
94
97
|
exports.socialReceiveCursorSchema = (0, objects_1.defineComponent)('SocialReceiveCursor', zod_1.z
|
|
95
98
|
.object({
|
|
@@ -108,6 +111,58 @@ exports.socialReceiveCursorSchema = (0, objects_1.defineComponent)('SocialReceiv
|
|
|
108
111
|
.describe("The caller's CURRENT identity public key: their DID's `#key-1`, read from Oxy at request time (never cached), as lowercase hex of the key exactly as the DID publishes it (`publicKeyHex`, the compressed secp256k1 key) — the same encoding as `identity_public_key`. Compare the device's key with THIS, not with `identity_public_key`, which only says what the last reservation used. `null` for a keyless (custodial) account."),
|
|
109
112
|
})
|
|
110
113
|
.strict());
|
|
114
|
+
/**
|
|
115
|
+
* The caller's receive addresses after a sync cursor (ADR 0021 D9, amended
|
|
116
|
+
* 2026-11-06). `after` is the `sync_cursor` of the previous answer, `0` (the
|
|
117
|
+
* default) from the start.
|
|
118
|
+
*/
|
|
119
|
+
exports.socialReceiveAddressesQuery = zod_1.z
|
|
120
|
+
.object({
|
|
121
|
+
network: primitives_1.network,
|
|
122
|
+
after: (0, params_1.queryInteger)({ min: 0, max: MAX_DERIVATION_INDEX })
|
|
123
|
+
.optional()
|
|
124
|
+
.describe('The `sync_cursor` of the previous page or sync; absent (or `0`) lists from the first address.'),
|
|
125
|
+
limit: (0, params_1.queryInteger)({ min: 1, max: payments_1.SOCIAL_RECEIVE_ADDRESSES_PAGE_MAX })
|
|
126
|
+
.optional()
|
|
127
|
+
.describe(`At most this many addresses (default ${payments_1.SOCIAL_RECEIVE_ADDRESSES_PAGE_DEFAULT}); a page exceeds it only by addresses sharing its last index.`),
|
|
128
|
+
})
|
|
129
|
+
.strict();
|
|
130
|
+
/**
|
|
131
|
+
* One FairCoin address the gateway handed out in the caller's Peable wallet —
|
|
132
|
+
* for a payment (merchant, seller, invoice, raw intent, one output of a split
|
|
133
|
+
* payment) or an `@username` request — under ANY key the account has had.
|
|
134
|
+
* Addresses are never reused: each is a fresh index of the account's one
|
|
135
|
+
* cursor (ADR 0002, ADR 0021 D5, D9).
|
|
136
|
+
*/
|
|
137
|
+
exports.socialReceiveAddressSchema = (0, objects_1.defineComponent)('SocialReceiveAddress', zod_1.z
|
|
138
|
+
.object({
|
|
139
|
+
address: zod_1.z.string().describe('The FairCoin address.'),
|
|
140
|
+
derivation_index: zod_1.z
|
|
141
|
+
.number()
|
|
142
|
+
.int()
|
|
143
|
+
.positive()
|
|
144
|
+
.describe("Its index in the account's social-receive tree (`deriveSocialReceiveAddress(key, index)`); index 0, the stable default address, is never handed out."),
|
|
145
|
+
identity_public_key: zod_1.z
|
|
146
|
+
.string()
|
|
147
|
+
.nullable()
|
|
148
|
+
.describe("The identity public key the address was derived from, in the encoding of the cursor's `identity_public_key` (lowercase hex of the DID `#key-1` bytes). It may be a key the account has since replaced. `null` only for an address handed out before keys were recorded."),
|
|
149
|
+
network: primitives_1.network,
|
|
150
|
+
created: primitives_1.unixSeconds.describe('When the address was handed out.'),
|
|
151
|
+
})
|
|
152
|
+
.strict());
|
|
153
|
+
exports.socialReceiveAddressesSchema = (0, objects_1.defineComponent)('SocialReceiveAddresses', zod_1.z
|
|
154
|
+
.object({
|
|
155
|
+
addresses: zod_1.z
|
|
156
|
+
.array(exports.socialReceiveAddressSchema)
|
|
157
|
+
.describe('In ascending `derivation_index`, each address once.'),
|
|
158
|
+
has_more: zod_1.z.boolean().describe('More addresses follow `sync_cursor`: ask again with it.'),
|
|
159
|
+
sync_cursor: zod_1.z
|
|
160
|
+
.number()
|
|
161
|
+
.int()
|
|
162
|
+
.nonnegative()
|
|
163
|
+
.describe('Pass as `after` to continue — the highest `derivation_index` in this page, or `after` when the page is empty. Monotonic: an address handed out later always has a higher index, so a wallet that stored it misses nothing by asking from it.'),
|
|
164
|
+
})
|
|
165
|
+
.strict());
|
|
111
166
|
exports.socialPaymentsQuery = networkQuery;
|
|
112
167
|
/**
|
|
113
168
|
* One social payment as the CALLER saw it — the address-free view, and the
|
|
@@ -148,7 +203,7 @@ exports.socialRoutes = [
|
|
|
148
203
|
path: '/v1/social/{username}/next_address',
|
|
149
204
|
tag: 'Social payments',
|
|
150
205
|
summary: 'Reserve an address to pay a person',
|
|
151
|
-
description: "A fresh address of the recipient's, derived from their Oxy identity key. Limited per (sender, recipient) pair; a recipient without an identity answers 409 `keyless_recipient`, and one
|
|
206
|
+
description: "A fresh address of the recipient's, derived from their Oxy identity key — or the one this sender already holds and has not paid. Limited per sender and per (sender, recipient) pair; a recipient without an identity answers 409 `keyless_recipient`, and one handed too many fresh `@username` addresses in the last day 503 `faircoin_capacity_reached`; paying yourself is refused.",
|
|
152
207
|
auth: 'user',
|
|
153
208
|
params: { username: 'The recipient’s Oxy username.' },
|
|
154
209
|
body: exports.socialNextAddressParams,
|
|
@@ -165,6 +220,17 @@ exports.socialRoutes = [
|
|
|
165
220
|
query: exports.socialReceiveCursorQuery,
|
|
166
221
|
response: exports.socialReceiveCursorSchema,
|
|
167
222
|
}),
|
|
223
|
+
(0, route_1.defineRoute)({
|
|
224
|
+
operationId: 'listSocialReceiveAddresses',
|
|
225
|
+
method: 'get',
|
|
226
|
+
path: '/v1/social/me/receive_addresses',
|
|
227
|
+
tag: 'Social payments',
|
|
228
|
+
summary: "List the caller's receive addresses",
|
|
229
|
+
description: "Every FairCoin address handed out in the caller's Peable wallet on `network` — payments and `@username` alike, under every key the account has had — after `after`, in ascending index, for whoever the session acts as (an organization's, when acting as it). The wallet watches exactly this set (ADR 0021 D9). Read-only.",
|
|
230
|
+
auth: 'user',
|
|
231
|
+
query: exports.socialReceiveAddressesQuery,
|
|
232
|
+
response: exports.socialReceiveAddressesSchema,
|
|
233
|
+
}),
|
|
168
234
|
(0, route_1.defineRoute)({
|
|
169
235
|
operationId: 'listSocialPayments',
|
|
170
236
|
method: 'get',
|
|
@@ -134,8 +134,7 @@ exports.ERROR_CODE_DESCRIPTIONS = {
|
|
|
134
134
|
faircoin_price_unavailable: 'No fresh FairCoin price exists right now, so this order cannot be quoted in FAIR. The other payment methods still work; try FairCoin again shortly.',
|
|
135
135
|
faircoin_wallet_missing: "The Peable wallet that receives this payment (the merchant owner's, or the seller's) isn't set up yet, so it cannot be paid in FairCoin. The other payment methods still work.",
|
|
136
136
|
faircoin_network_closed: 'FairCoin payments on this network are not open on this deployment yet. The other payment methods still work.',
|
|
137
|
-
faircoin_capacity_reached: 'Too many FairCoin
|
|
138
|
-
faircoin_receive_tree_full: "Every FairCoin address the recipient's Peable wallet watches has been handed out, so no new one can be derived for them. Nothing was reserved.",
|
|
137
|
+
faircoin_capacity_reached: 'Too many FairCoin addresses of this recipient were handed out in the last day without being paid, so no new one is handed out right now. Nothing was reserved. The other payment methods still work; try FairCoin again later.',
|
|
139
138
|
faircoin_amount_too_small: "One seller's share of this order is below the smallest amount the FairCoin network relays, so it cannot be paid in FairCoin. The other payment methods still work.",
|
|
140
139
|
credit_note_exceeds_invoice: "The credit note's amount exceeds what the invoice can still credit.",
|
|
141
140
|
test_clock_unexpected_state: 'The test clock is advancing; wait until it is ready.',
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// contracts are built from. Zod-free, so the wallet and the shared types read
|
|
5
5
|
// them without bundling a schema.
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.SIMULATED_FAIRCOIN_OUTCOMES = exports.ENRICH_MAX_ADDRESSES = exports.ENRICHMENT_KINDS = exports.SOCIAL_PAYMENT_DIRECTIONS = exports.SOCIAL_SOURCE_REF_MAX_LENGTH = exports.SOCIAL_SOURCE_APP_MAX_LENGTH = exports.SETUP_INTENT_CANCELLATION_REASONS = exports.SETUP_INTENT_USAGES = exports.SETUP_INTENT_STATUSES = exports.DISPUTE_EVIDENCE_TEXT_MAX = exports.DISPUTE_FILE_EVIDENCE_FIELDS = exports.DISPUTE_TEXT_EVIDENCE_FIELDS = exports.DISPUTE_REASONS = exports.DISPUTE_STATUSES = exports.SETTLEMENT_STATUSES = exports.REFUND_ORIGINS = exports.REFUND_REASONS = exports.REFUND_STATUSES = exports.CLIENT_ACTION_KINDS = exports.PAYMENT_ERROR_TYPES = exports.PAYMENT_METHOD_TYPES = exports.CARD_RAIL_PAYMENT_METHOD_TYPES = exports.PAYMENT_INTENT_SETUP_FUTURE_USAGES = exports.PAYMENT_INTENT_CAPTURE_METHODS = exports.MERCHANT_CANCELLATION_REASONS = exports.PAYMENT_INTENT_CANCELLATION_REASONS = exports.PAYMENT_INTENT_STATUSES = exports.PAYMENT_INTENT_MAX_EXPIRES_IN_SECONDS = exports.PAYMENT_INTENT_RAILS = void 0;
|
|
7
|
+
exports.SIMULATED_FAIRCOIN_OUTCOMES = exports.SOCIAL_RECEIVE_ADDRESSES_PAGE_MAX = exports.SOCIAL_RECEIVE_ADDRESSES_PAGE_DEFAULT = exports.ENRICH_MAX_ADDRESSES = exports.ENRICHMENT_KINDS = exports.SOCIAL_PAYMENT_DIRECTIONS = exports.SOCIAL_SOURCE_REF_MAX_LENGTH = exports.SOCIAL_SOURCE_APP_MAX_LENGTH = exports.SETUP_INTENT_CANCELLATION_REASONS = exports.SETUP_INTENT_USAGES = exports.SETUP_INTENT_STATUSES = exports.DISPUTE_EVIDENCE_TEXT_MAX = exports.DISPUTE_FILE_EVIDENCE_FIELDS = exports.DISPUTE_TEXT_EVIDENCE_FIELDS = exports.DISPUTE_REASONS = exports.DISPUTE_STATUSES = exports.SETTLEMENT_STATUSES = exports.REFUND_ORIGINS = exports.REFUND_REASONS = exports.REFUND_STATUSES = exports.CLIENT_ACTION_KINDS = exports.PAYMENT_ERROR_TYPES = exports.PAYMENT_METHOD_TYPES = exports.CARD_RAIL_PAYMENT_METHOD_TYPES = exports.PAYMENT_INTENT_SETUP_FUTURE_USAGES = exports.PAYMENT_INTENT_CAPTURE_METHODS = exports.MERCHANT_CANCELLATION_REASONS = exports.PAYMENT_INTENT_CANCELLATION_REASONS = exports.PAYMENT_INTENT_STATUSES = exports.PAYMENT_INTENT_MAX_EXPIRES_IN_SECONDS = exports.PAYMENT_INTENT_RAILS = void 0;
|
|
8
8
|
/**
|
|
9
9
|
* Which rail moves the money (ADR 0001 D1). On the INTENT, not on the merchant:
|
|
10
10
|
* one merchant takes both, and the rail decides which fields mean anything.
|
|
@@ -13,8 +13,8 @@ exports.PAYMENT_INTENT_RAILS = ['faircoin', 'card'];
|
|
|
13
13
|
/**
|
|
14
14
|
* The longest a PaymentIntent created through the API may stay payable before
|
|
15
15
|
* it expires (`expires_in_seconds`): 24 hours. A FairCoin payment holds a
|
|
16
|
-
* reserved address in the recipient's wallet for as long as it is payable,
|
|
17
|
-
*
|
|
16
|
+
* reserved address in the recipient's wallet for as long as it is payable, and
|
|
17
|
+
* the recipient's bound on unpaid addresses looks back over a day (ADR 0021 D9).
|
|
18
18
|
*/
|
|
19
19
|
exports.PAYMENT_INTENT_MAX_EXPIRES_IN_SECONDS = 24 * 60 * 60;
|
|
20
20
|
/**
|
|
@@ -200,6 +200,12 @@ exports.SOCIAL_PAYMENT_DIRECTIONS = ['sent', 'received'];
|
|
|
200
200
|
exports.ENRICHMENT_KINDS = ['merchant', 'user', 'unknown'];
|
|
201
201
|
/** How many addresses one `POST /v1/enrich` resolves (and one social history lists). */
|
|
202
202
|
exports.ENRICH_MAX_ADDRESSES = 50;
|
|
203
|
+
/**
|
|
204
|
+
* One page of `GET /v1/social/me/receive_addresses` (ADR 0021 D9, amended
|
|
205
|
+
* 2026-11-06): the default and the most a wallet may ask for at once.
|
|
206
|
+
*/
|
|
207
|
+
exports.SOCIAL_RECEIVE_ADDRESSES_PAGE_DEFAULT = 500;
|
|
208
|
+
exports.SOCIAL_RECEIVE_ADDRESSES_PAGE_MAX = 1000;
|
|
203
209
|
// ---------------------------------------------------------------------------
|
|
204
210
|
// Test helpers
|
|
205
211
|
// ---------------------------------------------------------------------------
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { defineComponent } from '../../common/objects.js';
|
|
3
|
+
import { queryInteger } from '../../common/params.js';
|
|
4
|
+
/** The highest BIP32 non-hardened child index, `int4`'s ceiling (`schema/valueSets.ts`). */
|
|
5
|
+
const MAX_DERIVATION_INDEX = 2147483647;
|
|
3
6
|
import { network, unixSeconds } from '../../common/primitives.js';
|
|
4
7
|
import { defineRoute } from '../../route.js';
|
|
5
|
-
import { ENRICH_MAX_ADDRESSES, ENRICHMENT_KINDS, SOCIAL_PAYMENT_DIRECTIONS, SOCIAL_SOURCE_APP_MAX_LENGTH, SOCIAL_SOURCE_REF_MAX_LENGTH, } from '../../vocabulary/payments.js';
|
|
8
|
+
import { ENRICH_MAX_ADDRESSES, ENRICHMENT_KINDS, SOCIAL_PAYMENT_DIRECTIONS, SOCIAL_RECEIVE_ADDRESSES_PAGE_DEFAULT, SOCIAL_RECEIVE_ADDRESSES_PAGE_MAX, SOCIAL_SOURCE_APP_MAX_LENGTH, SOCIAL_SOURCE_REF_MAX_LENGTH, } from '../../vocabulary/payments.js';
|
|
6
9
|
/**
|
|
7
10
|
* Social payments (pay a person by `@username`) and transaction enrichment —
|
|
8
11
|
* the wallet's routes, called with the person's own Oxy session. Display-only
|
|
@@ -83,10 +86,10 @@ export const socialNextAddressSchema = defineComponent('SocialNextAddress', z
|
|
|
83
86
|
const networkQuery = z.object({ network });
|
|
84
87
|
export const socialReceiveCursorQuery = networkQuery;
|
|
85
88
|
/**
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
89
|
+
* The caller's cursor and keys. The addresses to watch are
|
|
90
|
+
* `GET /v1/social/me/receive_addresses` (ADR 0021 D9, amended 2026-11-06);
|
|
91
|
+
* `reserved_through` only says how far the cursor went, and the device
|
|
92
|
+
* compares its key with `account_identity_public_key`.
|
|
90
93
|
*/
|
|
91
94
|
export const socialReceiveCursorSchema = defineComponent('SocialReceiveCursor', z
|
|
92
95
|
.object({
|
|
@@ -105,6 +108,58 @@ export const socialReceiveCursorSchema = defineComponent('SocialReceiveCursor',
|
|
|
105
108
|
.describe("The caller's CURRENT identity public key: their DID's `#key-1`, read from Oxy at request time (never cached), as lowercase hex of the key exactly as the DID publishes it (`publicKeyHex`, the compressed secp256k1 key) — the same encoding as `identity_public_key`. Compare the device's key with THIS, not with `identity_public_key`, which only says what the last reservation used. `null` for a keyless (custodial) account."),
|
|
106
109
|
})
|
|
107
110
|
.strict());
|
|
111
|
+
/**
|
|
112
|
+
* The caller's receive addresses after a sync cursor (ADR 0021 D9, amended
|
|
113
|
+
* 2026-11-06). `after` is the `sync_cursor` of the previous answer, `0` (the
|
|
114
|
+
* default) from the start.
|
|
115
|
+
*/
|
|
116
|
+
export const socialReceiveAddressesQuery = z
|
|
117
|
+
.object({
|
|
118
|
+
network,
|
|
119
|
+
after: queryInteger({ min: 0, max: MAX_DERIVATION_INDEX })
|
|
120
|
+
.optional()
|
|
121
|
+
.describe('The `sync_cursor` of the previous page or sync; absent (or `0`) lists from the first address.'),
|
|
122
|
+
limit: queryInteger({ min: 1, max: SOCIAL_RECEIVE_ADDRESSES_PAGE_MAX })
|
|
123
|
+
.optional()
|
|
124
|
+
.describe(`At most this many addresses (default ${SOCIAL_RECEIVE_ADDRESSES_PAGE_DEFAULT}); a page exceeds it only by addresses sharing its last index.`),
|
|
125
|
+
})
|
|
126
|
+
.strict();
|
|
127
|
+
/**
|
|
128
|
+
* One FairCoin address the gateway handed out in the caller's Peable wallet —
|
|
129
|
+
* for a payment (merchant, seller, invoice, raw intent, one output of a split
|
|
130
|
+
* payment) or an `@username` request — under ANY key the account has had.
|
|
131
|
+
* Addresses are never reused: each is a fresh index of the account's one
|
|
132
|
+
* cursor (ADR 0002, ADR 0021 D5, D9).
|
|
133
|
+
*/
|
|
134
|
+
export const socialReceiveAddressSchema = defineComponent('SocialReceiveAddress', z
|
|
135
|
+
.object({
|
|
136
|
+
address: z.string().describe('The FairCoin address.'),
|
|
137
|
+
derivation_index: z
|
|
138
|
+
.number()
|
|
139
|
+
.int()
|
|
140
|
+
.positive()
|
|
141
|
+
.describe("Its index in the account's social-receive tree (`deriveSocialReceiveAddress(key, index)`); index 0, the stable default address, is never handed out."),
|
|
142
|
+
identity_public_key: z
|
|
143
|
+
.string()
|
|
144
|
+
.nullable()
|
|
145
|
+
.describe("The identity public key the address was derived from, in the encoding of the cursor's `identity_public_key` (lowercase hex of the DID `#key-1` bytes). It may be a key the account has since replaced. `null` only for an address handed out before keys were recorded."),
|
|
146
|
+
network,
|
|
147
|
+
created: unixSeconds.describe('When the address was handed out.'),
|
|
148
|
+
})
|
|
149
|
+
.strict());
|
|
150
|
+
export const socialReceiveAddressesSchema = defineComponent('SocialReceiveAddresses', z
|
|
151
|
+
.object({
|
|
152
|
+
addresses: z
|
|
153
|
+
.array(socialReceiveAddressSchema)
|
|
154
|
+
.describe('In ascending `derivation_index`, each address once.'),
|
|
155
|
+
has_more: z.boolean().describe('More addresses follow `sync_cursor`: ask again with it.'),
|
|
156
|
+
sync_cursor: z
|
|
157
|
+
.number()
|
|
158
|
+
.int()
|
|
159
|
+
.nonnegative()
|
|
160
|
+
.describe('Pass as `after` to continue — the highest `derivation_index` in this page, or `after` when the page is empty. Monotonic: an address handed out later always has a higher index, so a wallet that stored it misses nothing by asking from it.'),
|
|
161
|
+
})
|
|
162
|
+
.strict());
|
|
108
163
|
export const socialPaymentsQuery = networkQuery;
|
|
109
164
|
/**
|
|
110
165
|
* One social payment as the CALLER saw it — the address-free view, and the
|
|
@@ -145,7 +200,7 @@ export const socialRoutes = [
|
|
|
145
200
|
path: '/v1/social/{username}/next_address',
|
|
146
201
|
tag: 'Social payments',
|
|
147
202
|
summary: 'Reserve an address to pay a person',
|
|
148
|
-
description: "A fresh address of the recipient's, derived from their Oxy identity key. Limited per (sender, recipient) pair; a recipient without an identity answers 409 `keyless_recipient`, and one
|
|
203
|
+
description: "A fresh address of the recipient's, derived from their Oxy identity key — or the one this sender already holds and has not paid. Limited per sender and per (sender, recipient) pair; a recipient without an identity answers 409 `keyless_recipient`, and one handed too many fresh `@username` addresses in the last day 503 `faircoin_capacity_reached`; paying yourself is refused.",
|
|
149
204
|
auth: 'user',
|
|
150
205
|
params: { username: 'The recipient’s Oxy username.' },
|
|
151
206
|
body: socialNextAddressParams,
|
|
@@ -162,6 +217,17 @@ export const socialRoutes = [
|
|
|
162
217
|
query: socialReceiveCursorQuery,
|
|
163
218
|
response: socialReceiveCursorSchema,
|
|
164
219
|
}),
|
|
220
|
+
defineRoute({
|
|
221
|
+
operationId: 'listSocialReceiveAddresses',
|
|
222
|
+
method: 'get',
|
|
223
|
+
path: '/v1/social/me/receive_addresses',
|
|
224
|
+
tag: 'Social payments',
|
|
225
|
+
summary: "List the caller's receive addresses",
|
|
226
|
+
description: "Every FairCoin address handed out in the caller's Peable wallet on `network` — payments and `@username` alike, under every key the account has had — after `after`, in ascending index, for whoever the session acts as (an organization's, when acting as it). The wallet watches exactly this set (ADR 0021 D9). Read-only.",
|
|
227
|
+
auth: 'user',
|
|
228
|
+
query: socialReceiveAddressesQuery,
|
|
229
|
+
response: socialReceiveAddressesSchema,
|
|
230
|
+
}),
|
|
165
231
|
defineRoute({
|
|
166
232
|
operationId: 'listSocialPayments',
|
|
167
233
|
method: 'get',
|
|
@@ -129,8 +129,7 @@ export const ERROR_CODE_DESCRIPTIONS = {
|
|
|
129
129
|
faircoin_price_unavailable: 'No fresh FairCoin price exists right now, so this order cannot be quoted in FAIR. The other payment methods still work; try FairCoin again shortly.',
|
|
130
130
|
faircoin_wallet_missing: "The Peable wallet that receives this payment (the merchant owner's, or the seller's) isn't set up yet, so it cannot be paid in FairCoin. The other payment methods still work.",
|
|
131
131
|
faircoin_network_closed: 'FairCoin payments on this network are not open on this deployment yet. The other payment methods still work.',
|
|
132
|
-
faircoin_capacity_reached: 'Too many FairCoin
|
|
133
|
-
faircoin_receive_tree_full: "Every FairCoin address the recipient's Peable wallet watches has been handed out, so no new one can be derived for them. Nothing was reserved.",
|
|
132
|
+
faircoin_capacity_reached: 'Too many FairCoin addresses of this recipient were handed out in the last day without being paid, so no new one is handed out right now. Nothing was reserved. The other payment methods still work; try FairCoin again later.',
|
|
134
133
|
faircoin_amount_too_small: "One seller's share of this order is below the smallest amount the FairCoin network relays, so it cannot be paid in FairCoin. The other payment methods still work.",
|
|
135
134
|
credit_note_exceeds_invoice: "The credit note's amount exceeds what the invoice can still credit.",
|
|
136
135
|
test_clock_unexpected_state: 'The test clock is advancing; wait until it is ready.',
|
|
@@ -10,8 +10,8 @@ export const PAYMENT_INTENT_RAILS = ['faircoin', 'card'];
|
|
|
10
10
|
/**
|
|
11
11
|
* The longest a PaymentIntent created through the API may stay payable before
|
|
12
12
|
* it expires (`expires_in_seconds`): 24 hours. A FairCoin payment holds a
|
|
13
|
-
* reserved address in the recipient's wallet for as long as it is payable,
|
|
14
|
-
*
|
|
13
|
+
* reserved address in the recipient's wallet for as long as it is payable, and
|
|
14
|
+
* the recipient's bound on unpaid addresses looks back over a day (ADR 0021 D9).
|
|
15
15
|
*/
|
|
16
16
|
export const PAYMENT_INTENT_MAX_EXPIRES_IN_SECONDS = 24 * 60 * 60;
|
|
17
17
|
/**
|
|
@@ -197,6 +197,12 @@ export const SOCIAL_PAYMENT_DIRECTIONS = ['sent', 'received'];
|
|
|
197
197
|
export const ENRICHMENT_KINDS = ['merchant', 'user', 'unknown'];
|
|
198
198
|
/** How many addresses one `POST /v1/enrich` resolves (and one social history lists). */
|
|
199
199
|
export const ENRICH_MAX_ADDRESSES = 50;
|
|
200
|
+
/**
|
|
201
|
+
* One page of `GET /v1/social/me/receive_addresses` (ADR 0021 D9, amended
|
|
202
|
+
* 2026-11-06): the default and the most a wallet may ask for at once.
|
|
203
|
+
*/
|
|
204
|
+
export const SOCIAL_RECEIVE_ADDRESSES_PAGE_DEFAULT = 500;
|
|
205
|
+
export const SOCIAL_RECEIVE_ADDRESSES_PAGE_MAX = 1000;
|
|
200
206
|
// ---------------------------------------------------------------------------
|
|
201
207
|
// Test helpers
|
|
202
208
|
// ---------------------------------------------------------------------------
|
|
@@ -3712,7 +3712,7 @@ export declare const paymentsRoutes: readonly [{
|
|
|
3712
3712
|
readonly path: "/v1/social/{username}/next_address";
|
|
3713
3713
|
readonly tag: "Social payments";
|
|
3714
3714
|
readonly summary: "Reserve an address to pay a person";
|
|
3715
|
-
readonly description: "A fresh address of the recipient's, derived from their Oxy identity key. Limited per (sender, recipient) pair; a recipient without an identity answers 409 `keyless_recipient`, and one
|
|
3715
|
+
readonly description: "A fresh address of the recipient's, derived from their Oxy identity key — or the one this sender already holds and has not paid. Limited per sender and per (sender, recipient) pair; a recipient without an identity answers 409 `keyless_recipient`, and one handed too many fresh `@username` addresses in the last day 503 `faircoin_capacity_reached`; paying yourself is refused.";
|
|
3716
3716
|
readonly auth: "user";
|
|
3717
3717
|
readonly params: {
|
|
3718
3718
|
readonly username: "The recipient’s Oxy username.";
|
|
@@ -3750,6 +3750,36 @@ export declare const paymentsRoutes: readonly [{
|
|
|
3750
3750
|
identity_public_key: import("zod").ZodNullable<import("zod").ZodString>;
|
|
3751
3751
|
account_identity_public_key: import("zod").ZodNullable<import("zod").ZodString>;
|
|
3752
3752
|
}, import("zod/v4/core").$strict>;
|
|
3753
|
+
}, {
|
|
3754
|
+
readonly operationId: "listSocialReceiveAddresses";
|
|
3755
|
+
readonly method: "get";
|
|
3756
|
+
readonly path: "/v1/social/me/receive_addresses";
|
|
3757
|
+
readonly tag: "Social payments";
|
|
3758
|
+
readonly summary: "List the caller's receive addresses";
|
|
3759
|
+
readonly description: "Every FairCoin address handed out in the caller's Peable wallet on `network` — payments and `@username` alike, under every key the account has had — after `after`, in ascending index, for whoever the session acts as (an organization's, when acting as it). The wallet watches exactly this set (ADR 0021 D9). Read-only.";
|
|
3760
|
+
readonly auth: "user";
|
|
3761
|
+
readonly query: import("zod").ZodObject<{
|
|
3762
|
+
network: import("zod").ZodEnum<{
|
|
3763
|
+
mainnet: "mainnet";
|
|
3764
|
+
testnet: "testnet";
|
|
3765
|
+
}>;
|
|
3766
|
+
after: import("zod").ZodOptional<import("zod").ZodPipe<import("zod").ZodPipe<import("zod").ZodUnion<readonly [import("zod").ZodNumber, import("zod").ZodString]>, import("zod").ZodTransform<number, string | number>>, import("zod").ZodNumber>>;
|
|
3767
|
+
limit: import("zod").ZodOptional<import("zod").ZodPipe<import("zod").ZodPipe<import("zod").ZodUnion<readonly [import("zod").ZodNumber, import("zod").ZodString]>, import("zod").ZodTransform<number, string | number>>, import("zod").ZodNumber>>;
|
|
3768
|
+
}, import("zod/v4/core").$strict>;
|
|
3769
|
+
readonly response: import("zod").ZodObject<{
|
|
3770
|
+
addresses: import("zod").ZodArray<import("zod").ZodObject<{
|
|
3771
|
+
address: import("zod").ZodString;
|
|
3772
|
+
derivation_index: import("zod").ZodNumber;
|
|
3773
|
+
identity_public_key: import("zod").ZodNullable<import("zod").ZodString>;
|
|
3774
|
+
network: import("zod").ZodEnum<{
|
|
3775
|
+
mainnet: "mainnet";
|
|
3776
|
+
testnet: "testnet";
|
|
3777
|
+
}>;
|
|
3778
|
+
created: import("zod").ZodNumber;
|
|
3779
|
+
}, import("zod/v4/core").$strict>>;
|
|
3780
|
+
has_more: import("zod").ZodBoolean;
|
|
3781
|
+
sync_cursor: import("zod").ZodNumber;
|
|
3782
|
+
}, import("zod/v4/core").$strict>;
|
|
3753
3783
|
}, {
|
|
3754
3784
|
readonly operationId: "listSocialPayments";
|
|
3755
3785
|
readonly method: "get";
|
|
@@ -68,10 +68,10 @@ export declare const socialReceiveCursorQuery: z.ZodObject<{
|
|
|
68
68
|
}, z.core.$strip>;
|
|
69
69
|
export type SocialReceiveCursorParams = z.input<typeof socialReceiveCursorQuery>;
|
|
70
70
|
/**
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
71
|
+
* The caller's cursor and keys. The addresses to watch are
|
|
72
|
+
* `GET /v1/social/me/receive_addresses` (ADR 0021 D9, amended 2026-11-06);
|
|
73
|
+
* `reserved_through` only says how far the cursor went, and the device
|
|
74
|
+
* compares its key with `account_identity_public_key`.
|
|
75
75
|
*/
|
|
76
76
|
export declare const socialReceiveCursorSchema: z.ZodObject<{
|
|
77
77
|
reserved_through: z.ZodNumber;
|
|
@@ -79,6 +79,53 @@ export declare const socialReceiveCursorSchema: z.ZodObject<{
|
|
|
79
79
|
account_identity_public_key: z.ZodNullable<z.ZodString>;
|
|
80
80
|
}, z.core.$strict>;
|
|
81
81
|
export type SocialReceiveCursorResponse = z.output<typeof socialReceiveCursorSchema>;
|
|
82
|
+
/**
|
|
83
|
+
* The caller's receive addresses after a sync cursor (ADR 0021 D9, amended
|
|
84
|
+
* 2026-11-06). `after` is the `sync_cursor` of the previous answer, `0` (the
|
|
85
|
+
* default) from the start.
|
|
86
|
+
*/
|
|
87
|
+
export declare const socialReceiveAddressesQuery: z.ZodObject<{
|
|
88
|
+
network: z.ZodEnum<{
|
|
89
|
+
mainnet: "mainnet";
|
|
90
|
+
testnet: "testnet";
|
|
91
|
+
}>;
|
|
92
|
+
after: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<number, string | number>>, z.ZodNumber>>;
|
|
93
|
+
limit: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<number, string | number>>, z.ZodNumber>>;
|
|
94
|
+
}, z.core.$strict>;
|
|
95
|
+
export type SocialReceiveAddressesParams = z.input<typeof socialReceiveAddressesQuery>;
|
|
96
|
+
/**
|
|
97
|
+
* One FairCoin address the gateway handed out in the caller's Peable wallet —
|
|
98
|
+
* for a payment (merchant, seller, invoice, raw intent, one output of a split
|
|
99
|
+
* payment) or an `@username` request — under ANY key the account has had.
|
|
100
|
+
* Addresses are never reused: each is a fresh index of the account's one
|
|
101
|
+
* cursor (ADR 0002, ADR 0021 D5, D9).
|
|
102
|
+
*/
|
|
103
|
+
export declare const socialReceiveAddressSchema: z.ZodObject<{
|
|
104
|
+
address: z.ZodString;
|
|
105
|
+
derivation_index: z.ZodNumber;
|
|
106
|
+
identity_public_key: z.ZodNullable<z.ZodString>;
|
|
107
|
+
network: z.ZodEnum<{
|
|
108
|
+
mainnet: "mainnet";
|
|
109
|
+
testnet: "testnet";
|
|
110
|
+
}>;
|
|
111
|
+
created: z.ZodNumber;
|
|
112
|
+
}, z.core.$strict>;
|
|
113
|
+
export type SocialReceiveAddress = z.output<typeof socialReceiveAddressSchema>;
|
|
114
|
+
export declare const socialReceiveAddressesSchema: z.ZodObject<{
|
|
115
|
+
addresses: z.ZodArray<z.ZodObject<{
|
|
116
|
+
address: z.ZodString;
|
|
117
|
+
derivation_index: z.ZodNumber;
|
|
118
|
+
identity_public_key: z.ZodNullable<z.ZodString>;
|
|
119
|
+
network: z.ZodEnum<{
|
|
120
|
+
mainnet: "mainnet";
|
|
121
|
+
testnet: "testnet";
|
|
122
|
+
}>;
|
|
123
|
+
created: z.ZodNumber;
|
|
124
|
+
}, z.core.$strict>>;
|
|
125
|
+
has_more: z.ZodBoolean;
|
|
126
|
+
sync_cursor: z.ZodNumber;
|
|
127
|
+
}, z.core.$strict>;
|
|
128
|
+
export type SocialReceiveAddressesResponse = z.output<typeof socialReceiveAddressesSchema>;
|
|
82
129
|
export declare const socialPaymentsQuery: z.ZodObject<{
|
|
83
130
|
network: z.ZodEnum<{
|
|
84
131
|
mainnet: "mainnet";
|
|
@@ -166,7 +213,7 @@ export declare const socialRoutes: readonly [{
|
|
|
166
213
|
readonly path: "/v1/social/{username}/next_address";
|
|
167
214
|
readonly tag: "Social payments";
|
|
168
215
|
readonly summary: "Reserve an address to pay a person";
|
|
169
|
-
readonly description: "A fresh address of the recipient's, derived from their Oxy identity key. Limited per (sender, recipient) pair; a recipient without an identity answers 409 `keyless_recipient`, and one
|
|
216
|
+
readonly description: "A fresh address of the recipient's, derived from their Oxy identity key — or the one this sender already holds and has not paid. Limited per sender and per (sender, recipient) pair; a recipient without an identity answers 409 `keyless_recipient`, and one handed too many fresh `@username` addresses in the last day 503 `faircoin_capacity_reached`; paying yourself is refused.";
|
|
170
217
|
readonly auth: "user";
|
|
171
218
|
readonly params: {
|
|
172
219
|
readonly username: "The recipient’s Oxy username.";
|
|
@@ -204,6 +251,36 @@ export declare const socialRoutes: readonly [{
|
|
|
204
251
|
identity_public_key: z.ZodNullable<z.ZodString>;
|
|
205
252
|
account_identity_public_key: z.ZodNullable<z.ZodString>;
|
|
206
253
|
}, z.core.$strict>;
|
|
254
|
+
}, {
|
|
255
|
+
readonly operationId: "listSocialReceiveAddresses";
|
|
256
|
+
readonly method: "get";
|
|
257
|
+
readonly path: "/v1/social/me/receive_addresses";
|
|
258
|
+
readonly tag: "Social payments";
|
|
259
|
+
readonly summary: "List the caller's receive addresses";
|
|
260
|
+
readonly description: "Every FairCoin address handed out in the caller's Peable wallet on `network` — payments and `@username` alike, under every key the account has had — after `after`, in ascending index, for whoever the session acts as (an organization's, when acting as it). The wallet watches exactly this set (ADR 0021 D9). Read-only.";
|
|
261
|
+
readonly auth: "user";
|
|
262
|
+
readonly query: z.ZodObject<{
|
|
263
|
+
network: z.ZodEnum<{
|
|
264
|
+
mainnet: "mainnet";
|
|
265
|
+
testnet: "testnet";
|
|
266
|
+
}>;
|
|
267
|
+
after: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<number, string | number>>, z.ZodNumber>>;
|
|
268
|
+
limit: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<number, string | number>>, z.ZodNumber>>;
|
|
269
|
+
}, z.core.$strict>;
|
|
270
|
+
readonly response: z.ZodObject<{
|
|
271
|
+
addresses: z.ZodArray<z.ZodObject<{
|
|
272
|
+
address: z.ZodString;
|
|
273
|
+
derivation_index: z.ZodNumber;
|
|
274
|
+
identity_public_key: z.ZodNullable<z.ZodString>;
|
|
275
|
+
network: z.ZodEnum<{
|
|
276
|
+
mainnet: "mainnet";
|
|
277
|
+
testnet: "testnet";
|
|
278
|
+
}>;
|
|
279
|
+
created: z.ZodNumber;
|
|
280
|
+
}, z.core.$strict>>;
|
|
281
|
+
has_more: z.ZodBoolean;
|
|
282
|
+
sync_cursor: z.ZodNumber;
|
|
283
|
+
}, z.core.$strict>;
|
|
207
284
|
}, {
|
|
208
285
|
readonly operationId: "listSocialPayments";
|
|
209
286
|
readonly method: "get";
|
|
@@ -108,8 +108,7 @@ export declare const ERROR_CODE_DESCRIPTIONS: {
|
|
|
108
108
|
readonly faircoin_price_unavailable: "No fresh FairCoin price exists right now, so this order cannot be quoted in FAIR. The other payment methods still work; try FairCoin again shortly.";
|
|
109
109
|
readonly faircoin_wallet_missing: "The Peable wallet that receives this payment (the merchant owner's, or the seller's) isn't set up yet, so it cannot be paid in FairCoin. The other payment methods still work.";
|
|
110
110
|
readonly faircoin_network_closed: "FairCoin payments on this network are not open on this deployment yet. The other payment methods still work.";
|
|
111
|
-
readonly faircoin_capacity_reached: "Too many FairCoin
|
|
112
|
-
readonly faircoin_receive_tree_full: "Every FairCoin address the recipient's Peable wallet watches has been handed out, so no new one can be derived for them. Nothing was reserved.";
|
|
111
|
+
readonly faircoin_capacity_reached: "Too many FairCoin addresses of this recipient were handed out in the last day without being paid, so no new one is handed out right now. Nothing was reserved. The other payment methods still work; try FairCoin again later.";
|
|
113
112
|
readonly faircoin_amount_too_small: "One seller's share of this order is below the smallest amount the FairCoin network relays, so it cannot be paid in FairCoin. The other payment methods still work.";
|
|
114
113
|
readonly credit_note_exceeds_invoice: "The credit note's amount exceeds what the invoice can still credit.";
|
|
115
114
|
readonly test_clock_unexpected_state: "The test clock is advancing; wait until it is ready.";
|
|
@@ -7,8 +7,8 @@ export type PaymentIntentRail = (typeof PAYMENT_INTENT_RAILS)[number];
|
|
|
7
7
|
/**
|
|
8
8
|
* The longest a PaymentIntent created through the API may stay payable before
|
|
9
9
|
* it expires (`expires_in_seconds`): 24 hours. A FairCoin payment holds a
|
|
10
|
-
* reserved address in the recipient's wallet for as long as it is payable,
|
|
11
|
-
*
|
|
10
|
+
* reserved address in the recipient's wallet for as long as it is payable, and
|
|
11
|
+
* the recipient's bound on unpaid addresses looks back over a day (ADR 0021 D9).
|
|
12
12
|
*/
|
|
13
13
|
export declare const PAYMENT_INTENT_MAX_EXPIRES_IN_SECONDS: number;
|
|
14
14
|
/**
|
|
@@ -122,6 +122,12 @@ export declare const ENRICHMENT_KINDS: readonly ["merchant", "user", "unknown"];
|
|
|
122
122
|
export type EnrichmentKind = (typeof ENRICHMENT_KINDS)[number];
|
|
123
123
|
/** How many addresses one `POST /v1/enrich` resolves (and one social history lists). */
|
|
124
124
|
export declare const ENRICH_MAX_ADDRESSES = 50;
|
|
125
|
+
/**
|
|
126
|
+
* One page of `GET /v1/social/me/receive_addresses` (ADR 0021 D9, amended
|
|
127
|
+
* 2026-11-06): the default and the most a wallet may ask for at once.
|
|
128
|
+
*/
|
|
129
|
+
export declare const SOCIAL_RECEIVE_ADDRESSES_PAGE_DEFAULT = 500;
|
|
130
|
+
export declare const SOCIAL_RECEIVE_ADDRESSES_PAGE_MAX = 1000;
|
|
125
131
|
/**
|
|
126
132
|
* What `simulate_faircoin_payment` pretends the payer did: `settled` paid the
|
|
127
133
|
* full amount (`processing` → `succeeded`); `underpaid` sent less
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@peable.to/contracts",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "The Peable wire, declared once: Zod contracts of every public route, the OpenAPI 3.1 generator and the closed value sets (ADR 0014 D5).",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* The size of a recipient's FairCoin receive tree (ADR 0021 D9, amended
|
|
4
|
-
* 2026-11-06) — ONE answer, read by the gateway that hands out indices and by
|
|
5
|
-
* the Peable wallet that watches them.
|
|
6
|
-
*
|
|
7
|
-
* Every FairCoin address the gateway reserves for an account — a merchant
|
|
8
|
-
* payment, a marketplace seller's, an invoice's, `@username` — is index `i` of
|
|
9
|
-
* that account's identity tree (ADR 0002, ADR 0021 D5). The wallet watches a
|
|
10
|
-
* contiguous window, indices `0 .. SOCIAL_RECEIVE_MAX_WATCHED - 1`, reaching
|
|
11
|
-
* {@link SOCIAL_RECEIVE_GAP_LIMIT} past the highest index reserved
|
|
12
|
-
* (`planSocialReceiveWindow` in `packages/frontend/src/wallet/social-receive.ts`),
|
|
13
|
-
* and stops offering `@username` once that reach would pass its bound. So an
|
|
14
|
-
* index is reserved only when the wallet, after reserving it, still reaches
|
|
15
|
-
* the gap above it inside its bound:
|
|
16
|
-
*
|
|
17
|
-
* index + SOCIAL_RECEIVE_GAP_LIMIT <= SOCIAL_RECEIVE_MAX_WATCHED - 1
|
|
18
|
-
* index < SOCIAL_RECEIVE_INDEX_LIMIT
|
|
19
|
-
*
|
|
20
|
-
* The gateway refuses to mint `index >= SOCIAL_RECEIVE_INDEX_LIMIT` (in the
|
|
21
|
-
* reservation's own statement), so every address it hands out is inside the
|
|
22
|
-
* window the wallet watches. Zod-free and dependency-free: the wallet bundles
|
|
23
|
-
* this module alone (`@peable.to/contracts/vocabulary/receiveTree`).
|
|
24
|
-
*/
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.SOCIAL_RECEIVE_NEARLY_FULL_REMAINING = exports.SOCIAL_RECEIVE_INDEX_LIMIT = exports.SOCIAL_RECEIVE_GAP_LIMIT = exports.SOCIAL_RECEIVE_MAX_WATCHED = void 0;
|
|
27
|
-
/** The most indices the wallet watches: `0 .. SOCIAL_RECEIVE_MAX_WATCHED - 1`. */
|
|
28
|
-
exports.SOCIAL_RECEIVE_MAX_WATCHED = 2000;
|
|
29
|
-
/**
|
|
30
|
-
* How many unused addresses the wallet watches beyond the highest index used
|
|
31
|
-
* or reserved — the FairCoin BIP44 external-chain gap limit.
|
|
32
|
-
*/
|
|
33
|
-
exports.SOCIAL_RECEIVE_GAP_LIMIT = 20;
|
|
34
|
-
/**
|
|
35
|
-
* The first index the gateway never mints (exclusive bound): `1 980`. Every
|
|
36
|
-
* minted index `i` satisfies `i < SOCIAL_RECEIVE_INDEX_LIMIT`, i.e.
|
|
37
|
-
* `i + SOCIAL_RECEIVE_GAP_LIMIT <= SOCIAL_RECEIVE_MAX_WATCHED - 1`.
|
|
38
|
-
*/
|
|
39
|
-
exports.SOCIAL_RECEIVE_INDEX_LIMIT = exports.SOCIAL_RECEIVE_MAX_WATCHED - exports.SOCIAL_RECEIVE_GAP_LIMIT;
|
|
40
|
-
/**
|
|
41
|
-
* How close to {@link SOCIAL_RECEIVE_INDEX_LIMIT} a tree is "nearly full":
|
|
42
|
-
* Orbit warns the owners once fewer fresh indices than this are left.
|
|
43
|
-
*/
|
|
44
|
-
exports.SOCIAL_RECEIVE_NEARLY_FULL_REMAINING = 200;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The size of a recipient's FairCoin receive tree (ADR 0021 D9, amended
|
|
3
|
-
* 2026-11-06) — ONE answer, read by the gateway that hands out indices and by
|
|
4
|
-
* the Peable wallet that watches them.
|
|
5
|
-
*
|
|
6
|
-
* Every FairCoin address the gateway reserves for an account — a merchant
|
|
7
|
-
* payment, a marketplace seller's, an invoice's, `@username` — is index `i` of
|
|
8
|
-
* that account's identity tree (ADR 0002, ADR 0021 D5). The wallet watches a
|
|
9
|
-
* contiguous window, indices `0 .. SOCIAL_RECEIVE_MAX_WATCHED - 1`, reaching
|
|
10
|
-
* {@link SOCIAL_RECEIVE_GAP_LIMIT} past the highest index reserved
|
|
11
|
-
* (`planSocialReceiveWindow` in `packages/frontend/src/wallet/social-receive.ts`),
|
|
12
|
-
* and stops offering `@username` once that reach would pass its bound. So an
|
|
13
|
-
* index is reserved only when the wallet, after reserving it, still reaches
|
|
14
|
-
* the gap above it inside its bound:
|
|
15
|
-
*
|
|
16
|
-
* index + SOCIAL_RECEIVE_GAP_LIMIT <= SOCIAL_RECEIVE_MAX_WATCHED - 1
|
|
17
|
-
* index < SOCIAL_RECEIVE_INDEX_LIMIT
|
|
18
|
-
*
|
|
19
|
-
* The gateway refuses to mint `index >= SOCIAL_RECEIVE_INDEX_LIMIT` (in the
|
|
20
|
-
* reservation's own statement), so every address it hands out is inside the
|
|
21
|
-
* window the wallet watches. Zod-free and dependency-free: the wallet bundles
|
|
22
|
-
* this module alone (`@peable.to/contracts/vocabulary/receiveTree`).
|
|
23
|
-
*/
|
|
24
|
-
/** The most indices the wallet watches: `0 .. SOCIAL_RECEIVE_MAX_WATCHED - 1`. */
|
|
25
|
-
export const SOCIAL_RECEIVE_MAX_WATCHED = 2000;
|
|
26
|
-
/**
|
|
27
|
-
* How many unused addresses the wallet watches beyond the highest index used
|
|
28
|
-
* or reserved — the FairCoin BIP44 external-chain gap limit.
|
|
29
|
-
*/
|
|
30
|
-
export const SOCIAL_RECEIVE_GAP_LIMIT = 20;
|
|
31
|
-
/**
|
|
32
|
-
* The first index the gateway never mints (exclusive bound): `1 980`. Every
|
|
33
|
-
* minted index `i` satisfies `i < SOCIAL_RECEIVE_INDEX_LIMIT`, i.e.
|
|
34
|
-
* `i + SOCIAL_RECEIVE_GAP_LIMIT <= SOCIAL_RECEIVE_MAX_WATCHED - 1`.
|
|
35
|
-
*/
|
|
36
|
-
export const SOCIAL_RECEIVE_INDEX_LIMIT = SOCIAL_RECEIVE_MAX_WATCHED - SOCIAL_RECEIVE_GAP_LIMIT;
|
|
37
|
-
/**
|
|
38
|
-
* How close to {@link SOCIAL_RECEIVE_INDEX_LIMIT} a tree is "nearly full":
|
|
39
|
-
* Orbit warns the owners once fewer fresh indices than this are left.
|
|
40
|
-
*/
|
|
41
|
-
export const SOCIAL_RECEIVE_NEARLY_FULL_REMAINING = 200;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The size of a recipient's FairCoin receive tree (ADR 0021 D9, amended
|
|
3
|
-
* 2026-11-06) — ONE answer, read by the gateway that hands out indices and by
|
|
4
|
-
* the Peable wallet that watches them.
|
|
5
|
-
*
|
|
6
|
-
* Every FairCoin address the gateway reserves for an account — a merchant
|
|
7
|
-
* payment, a marketplace seller's, an invoice's, `@username` — is index `i` of
|
|
8
|
-
* that account's identity tree (ADR 0002, ADR 0021 D5). The wallet watches a
|
|
9
|
-
* contiguous window, indices `0 .. SOCIAL_RECEIVE_MAX_WATCHED - 1`, reaching
|
|
10
|
-
* {@link SOCIAL_RECEIVE_GAP_LIMIT} past the highest index reserved
|
|
11
|
-
* (`planSocialReceiveWindow` in `packages/frontend/src/wallet/social-receive.ts`),
|
|
12
|
-
* and stops offering `@username` once that reach would pass its bound. So an
|
|
13
|
-
* index is reserved only when the wallet, after reserving it, still reaches
|
|
14
|
-
* the gap above it inside its bound:
|
|
15
|
-
*
|
|
16
|
-
* index + SOCIAL_RECEIVE_GAP_LIMIT <= SOCIAL_RECEIVE_MAX_WATCHED - 1
|
|
17
|
-
* index < SOCIAL_RECEIVE_INDEX_LIMIT
|
|
18
|
-
*
|
|
19
|
-
* The gateway refuses to mint `index >= SOCIAL_RECEIVE_INDEX_LIMIT` (in the
|
|
20
|
-
* reservation's own statement), so every address it hands out is inside the
|
|
21
|
-
* window the wallet watches. Zod-free and dependency-free: the wallet bundles
|
|
22
|
-
* this module alone (`@peable.to/contracts/vocabulary/receiveTree`).
|
|
23
|
-
*/
|
|
24
|
-
/** The most indices the wallet watches: `0 .. SOCIAL_RECEIVE_MAX_WATCHED - 1`. */
|
|
25
|
-
export declare const SOCIAL_RECEIVE_MAX_WATCHED = 2000;
|
|
26
|
-
/**
|
|
27
|
-
* How many unused addresses the wallet watches beyond the highest index used
|
|
28
|
-
* or reserved — the FairCoin BIP44 external-chain gap limit.
|
|
29
|
-
*/
|
|
30
|
-
export declare const SOCIAL_RECEIVE_GAP_LIMIT = 20;
|
|
31
|
-
/**
|
|
32
|
-
* The first index the gateway never mints (exclusive bound): `1 980`. Every
|
|
33
|
-
* minted index `i` satisfies `i < SOCIAL_RECEIVE_INDEX_LIMIT`, i.e.
|
|
34
|
-
* `i + SOCIAL_RECEIVE_GAP_LIMIT <= SOCIAL_RECEIVE_MAX_WATCHED - 1`.
|
|
35
|
-
*/
|
|
36
|
-
export declare const SOCIAL_RECEIVE_INDEX_LIMIT: number;
|
|
37
|
-
/**
|
|
38
|
-
* How close to {@link SOCIAL_RECEIVE_INDEX_LIMIT} a tree is "nearly full":
|
|
39
|
-
* Orbit warns the owners once fewer fresh indices than this are left.
|
|
40
|
-
*/
|
|
41
|
-
export declare const SOCIAL_RECEIVE_NEARLY_FULL_REMAINING = 200;
|