@peable.to/contracts 0.0.0-stage → 0.2.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.
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.contributionPatchSchema = exports.contributionOperationKeySchema = exports.contributionMintSchema = exports.contributionPageQuerySchema = exports.contributionCollectionListSchema = exports.contributionCollectionSchema = exports.contributionListSchema = exports.contributionLinkSchema = exports.createContributionSchema = exports.contributionDetailsSchema = exports.contributionAmountSchema = void 0;
4
+ exports.decimalContributionAmount = decimalContributionAmount;
5
+ exports.formatContributionAmount = formatContributionAmount;
6
+ const zod_1 = require("zod");
7
+ exports.contributionAmountSchema = zod_1.z
8
+ .string()
9
+ .regex(/^[1-9][0-9]{0,15}$/)
10
+ .refine((v) => /^[1-9][0-9]{0,15}$/.test(v) && BigInt(v) <= 9007199254740991n, 'Enter a positive FairCoin base-unit amount within the supported range');
11
+ exports.contributionDetailsSchema = zod_1.z
12
+ .object({
13
+ organizationId: zod_1.z.string().min(1).max(200),
14
+ purpose: zod_1.z.string().trim().min(1).max(500),
15
+ amountMode: zod_1.z.enum(['fixed', 'free']),
16
+ expiresAt: zod_1.z.iso.datetime().nullable(),
17
+ })
18
+ .strict();
19
+ exports.createContributionSchema = zod_1.z
20
+ .object({
21
+ purpose: exports.contributionDetailsSchema.shape.purpose,
22
+ amountMode: exports.contributionDetailsSchema.shape.amountMode,
23
+ amount: exports.contributionAmountSchema.optional(),
24
+ currency: zod_1.z.literal('FAIR'),
25
+ expiresAt: zod_1.z.iso.datetime().nullable().optional(),
26
+ })
27
+ .strict()
28
+ .refine((v) => (v.amountMode === 'free' ? v.amount === undefined : v.amount !== undefined), 'Fixed contributions require an amount; free contributions omit it');
29
+ exports.contributionLinkSchema = zod_1.z
30
+ .object({
31
+ id: zod_1.z.string(),
32
+ amount: zod_1.z.string(),
33
+ currency: zod_1.z.literal('FAIR'),
34
+ network: zod_1.z.enum(['mainnet', 'testnet']),
35
+ active: zod_1.z.boolean(),
36
+ url: zod_1.z.url(),
37
+ contribution: exports.contributionDetailsSchema,
38
+ createdAt: zod_1.z.iso.datetime(),
39
+ })
40
+ .strict();
41
+ exports.contributionListSchema = zod_1.z
42
+ .object({ items: zod_1.z.array(exports.contributionLinkSchema), nextCursor: zod_1.z.string().nullable() })
43
+ .strict();
44
+ exports.contributionCollectionSchema = zod_1.z
45
+ .object({
46
+ id: zod_1.z.string(),
47
+ amount: zod_1.z.string(),
48
+ currency: zod_1.z.literal('FAIR'),
49
+ status: zod_1.z.string(),
50
+ createdAt: zod_1.z.iso.datetime(),
51
+ refundCapability: zod_1.z.literal('unsupported_non_custodial'),
52
+ refunds: zod_1.z.array(zod_1.z
53
+ .object({
54
+ id: zod_1.z.string(),
55
+ amount: zod_1.z.string(),
56
+ status: zod_1.z.string(),
57
+ createdAt: zod_1.z.iso.datetime(),
58
+ })
59
+ .strict()),
60
+ })
61
+ .strict();
62
+ exports.contributionCollectionListSchema = zod_1.z
63
+ .object({ items: zod_1.z.array(exports.contributionCollectionSchema), nextCursor: zod_1.z.string().nullable() })
64
+ .strict();
65
+ exports.contributionPageQuerySchema = zod_1.z
66
+ .object({
67
+ limit: zod_1.z.coerce.number().int().min(1).max(100).default(20),
68
+ cursor: zod_1.z.string().max(1000).optional(),
69
+ environment: zod_1.z.enum(['development', 'staging', 'production']),
70
+ })
71
+ .strict();
72
+ exports.contributionMintSchema = zod_1.z
73
+ .object({ amount: exports.contributionAmountSchema.optional() })
74
+ .strict();
75
+ exports.contributionOperationKeySchema = zod_1.z.string().uuid();
76
+ exports.contributionPatchSchema = zod_1.z.object({ active: zod_1.z.boolean() }).strict();
77
+ function decimalContributionAmount(value) {
78
+ if (!/^(0|[1-9][0-9]{0,7})(\.[0-9]{1,8})?$/.test(value))
79
+ throw new Error('Enter a FAIR amount with at most eight decimals');
80
+ const [whole = '0', fraction = ''] = value.split('.');
81
+ return exports.contributionAmountSchema.parse((BigInt(whole) * 100000000n + BigInt(fraction.padEnd(8, '0'))).toString());
82
+ }
83
+ function formatContributionAmount(value) {
84
+ const units = BigInt(value);
85
+ const fraction = (units % 100000000n).toString().padStart(8, '0').replace(/0+$/, '');
86
+ return (units / 100000000n).toString() + (fraction ? `.${fraction}` : '');
87
+ }
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.contributionRoutes = void 0;
4
+ exports.contributionOpenApi = contributionOpenApi;
5
+ const zod_1 = require("zod");
6
+ const index_1 = require("./index");
7
+ const path = '/v1/organizations/{organizationId}/applications/{applicationId}/contributions';
8
+ exports.contributionRoutes = [
9
+ {
10
+ method: 'post',
11
+ path,
12
+ operationId: 'createContribution',
13
+ body: index_1.createContributionSchema,
14
+ response: index_1.contributionLinkSchema,
15
+ status: 201,
16
+ },
17
+ {
18
+ method: 'get',
19
+ path,
20
+ operationId: 'listContributions',
21
+ response: index_1.contributionListSchema,
22
+ status: 200,
23
+ },
24
+ {
25
+ method: 'patch',
26
+ path: `${path}/{id}`,
27
+ operationId: 'setContributionActive',
28
+ body: index_1.contributionPatchSchema,
29
+ response: index_1.contributionLinkSchema,
30
+ status: 200,
31
+ },
32
+ {
33
+ method: 'get',
34
+ path: `${path}/{id}/collections`,
35
+ operationId: 'listContributionCollections',
36
+ response: index_1.contributionCollectionListSchema,
37
+ status: 200,
38
+ },
39
+ ];
40
+ function contributionOpenApi() {
41
+ var _a;
42
+ const paths = {};
43
+ for (const route of exports.contributionRoutes) {
44
+ paths[_a = route.path] ?? (paths[_a] = {});
45
+ const parameters = [...route.path.matchAll(/\{([^}]+)\}/g)].map((match) => ({
46
+ in: 'path',
47
+ name: match[1],
48
+ required: true,
49
+ schema: { type: 'string' },
50
+ }));
51
+ parameters.push({
52
+ in: 'query',
53
+ name: 'environment',
54
+ required: true,
55
+ schema: { type: 'string', enum: ['development', 'staging', 'production'] },
56
+ });
57
+ if (route.method === 'get')
58
+ parameters.push({
59
+ in: 'query',
60
+ name: 'limit',
61
+ schema: { type: 'integer', minimum: 1, maximum: 100, default: 20 },
62
+ }, { in: 'query', name: 'cursor', schema: { type: 'string' } });
63
+ if (route.method === 'post')
64
+ parameters.push({
65
+ in: 'header',
66
+ name: 'Idempotency-Key',
67
+ required: true,
68
+ schema: { type: 'string', format: 'uuid' },
69
+ });
70
+ paths[route.path][route.method] = {
71
+ operationId: route.operationId,
72
+ security: [{ oxySession: [] }],
73
+ parameters,
74
+ ...('body' in route
75
+ ? {
76
+ requestBody: {
77
+ required: true,
78
+ content: { 'application/json': { schema: zod_1.z.toJSONSchema(route.body) } },
79
+ },
80
+ }
81
+ : {}),
82
+ responses: {
83
+ [route.status]: {
84
+ description: 'Success',
85
+ content: { 'application/json': { schema: zod_1.z.toJSONSchema(route.response) } },
86
+ },
87
+ default: {
88
+ description: 'Peable error envelope; HTTP status identifies failure',
89
+ content: {
90
+ 'application/json': {
91
+ schema: {
92
+ type: 'object',
93
+ required: ['error'],
94
+ properties: {
95
+ error: {
96
+ type: 'object',
97
+ required: ['type', 'message'],
98
+ properties: { type: { type: 'string' }, message: { type: 'string' } },
99
+ },
100
+ },
101
+ },
102
+ },
103
+ },
104
+ },
105
+ },
106
+ };
107
+ }
108
+ return {
109
+ openapi: '3.1.0',
110
+ info: {
111
+ title: 'Peable organization contributions',
112
+ version: '0.1.0',
113
+ description: 'One-off links. Human Oxy session for management; existing /v1/payment_links/{id}/public and /payment_intent remain anonymous. Fixed/free amounts use FAIR base units (8 decimals); the registered merchant determines the network. Refunds cannot be created by the watch-only gateway. No recurring billing.',
114
+ },
115
+ servers: [{ url: 'https://api.peable.to' }],
116
+ components: { securitySchemes: { oxySession: { type: 'http', scheme: 'bearer' } } },
117
+ paths,
118
+ };
119
+ }
@@ -0,0 +1,82 @@
1
+ import { z } from 'zod';
2
+ export const contributionAmountSchema = z
3
+ .string()
4
+ .regex(/^[1-9][0-9]{0,15}$/)
5
+ .refine((v) => /^[1-9][0-9]{0,15}$/.test(v) && BigInt(v) <= 9007199254740991n, 'Enter a positive FairCoin base-unit amount within the supported range');
6
+ export const contributionDetailsSchema = z
7
+ .object({
8
+ organizationId: z.string().min(1).max(200),
9
+ purpose: z.string().trim().min(1).max(500),
10
+ amountMode: z.enum(['fixed', 'free']),
11
+ expiresAt: z.iso.datetime().nullable(),
12
+ })
13
+ .strict();
14
+ export const createContributionSchema = z
15
+ .object({
16
+ purpose: contributionDetailsSchema.shape.purpose,
17
+ amountMode: contributionDetailsSchema.shape.amountMode,
18
+ amount: contributionAmountSchema.optional(),
19
+ currency: z.literal('FAIR'),
20
+ expiresAt: z.iso.datetime().nullable().optional(),
21
+ })
22
+ .strict()
23
+ .refine((v) => (v.amountMode === 'free' ? v.amount === undefined : v.amount !== undefined), 'Fixed contributions require an amount; free contributions omit it');
24
+ export const contributionLinkSchema = z
25
+ .object({
26
+ id: z.string(),
27
+ amount: z.string(),
28
+ currency: z.literal('FAIR'),
29
+ network: z.enum(['mainnet', 'testnet']),
30
+ active: z.boolean(),
31
+ url: z.url(),
32
+ contribution: contributionDetailsSchema,
33
+ createdAt: z.iso.datetime(),
34
+ })
35
+ .strict();
36
+ export const contributionListSchema = z
37
+ .object({ items: z.array(contributionLinkSchema), nextCursor: z.string().nullable() })
38
+ .strict();
39
+ export const contributionCollectionSchema = z
40
+ .object({
41
+ id: z.string(),
42
+ amount: z.string(),
43
+ currency: z.literal('FAIR'),
44
+ status: z.string(),
45
+ createdAt: z.iso.datetime(),
46
+ refundCapability: z.literal('unsupported_non_custodial'),
47
+ refunds: z.array(z
48
+ .object({
49
+ id: z.string(),
50
+ amount: z.string(),
51
+ status: z.string(),
52
+ createdAt: z.iso.datetime(),
53
+ })
54
+ .strict()),
55
+ })
56
+ .strict();
57
+ export const contributionCollectionListSchema = z
58
+ .object({ items: z.array(contributionCollectionSchema), nextCursor: z.string().nullable() })
59
+ .strict();
60
+ export const contributionPageQuerySchema = z
61
+ .object({
62
+ limit: z.coerce.number().int().min(1).max(100).default(20),
63
+ cursor: z.string().max(1000).optional(),
64
+ environment: z.enum(['development', 'staging', 'production']),
65
+ })
66
+ .strict();
67
+ export const contributionMintSchema = z
68
+ .object({ amount: contributionAmountSchema.optional() })
69
+ .strict();
70
+ export const contributionOperationKeySchema = z.string().uuid();
71
+ export const contributionPatchSchema = z.object({ active: z.boolean() }).strict();
72
+ export function decimalContributionAmount(value) {
73
+ if (!/^(0|[1-9][0-9]{0,7})(\.[0-9]{1,8})?$/.test(value))
74
+ throw new Error('Enter a FAIR amount with at most eight decimals');
75
+ const [whole = '0', fraction = ''] = value.split('.');
76
+ return contributionAmountSchema.parse((BigInt(whole) * 100000000n + BigInt(fraction.padEnd(8, '0'))).toString());
77
+ }
78
+ export function formatContributionAmount(value) {
79
+ const units = BigInt(value);
80
+ const fraction = (units % 100000000n).toString().padStart(8, '0').replace(/0+$/, '');
81
+ return (units / 100000000n).toString() + (fraction ? `.${fraction}` : '');
82
+ }
@@ -0,0 +1,115 @@
1
+ import { z } from 'zod';
2
+ import { createContributionSchema, contributionLinkSchema, contributionListSchema, contributionCollectionListSchema, contributionPatchSchema, } from './index.js';
3
+ const path = '/v1/organizations/{organizationId}/applications/{applicationId}/contributions';
4
+ export const contributionRoutes = [
5
+ {
6
+ method: 'post',
7
+ path,
8
+ operationId: 'createContribution',
9
+ body: createContributionSchema,
10
+ response: contributionLinkSchema,
11
+ status: 201,
12
+ },
13
+ {
14
+ method: 'get',
15
+ path,
16
+ operationId: 'listContributions',
17
+ response: contributionListSchema,
18
+ status: 200,
19
+ },
20
+ {
21
+ method: 'patch',
22
+ path: `${path}/{id}`,
23
+ operationId: 'setContributionActive',
24
+ body: contributionPatchSchema,
25
+ response: contributionLinkSchema,
26
+ status: 200,
27
+ },
28
+ {
29
+ method: 'get',
30
+ path: `${path}/{id}/collections`,
31
+ operationId: 'listContributionCollections',
32
+ response: contributionCollectionListSchema,
33
+ status: 200,
34
+ },
35
+ ];
36
+ export function contributionOpenApi() {
37
+ var _a;
38
+ const paths = {};
39
+ for (const route of contributionRoutes) {
40
+ paths[_a = route.path] ?? (paths[_a] = {});
41
+ const parameters = [...route.path.matchAll(/\{([^}]+)\}/g)].map((match) => ({
42
+ in: 'path',
43
+ name: match[1],
44
+ required: true,
45
+ schema: { type: 'string' },
46
+ }));
47
+ parameters.push({
48
+ in: 'query',
49
+ name: 'environment',
50
+ required: true,
51
+ schema: { type: 'string', enum: ['development', 'staging', 'production'] },
52
+ });
53
+ if (route.method === 'get')
54
+ parameters.push({
55
+ in: 'query',
56
+ name: 'limit',
57
+ schema: { type: 'integer', minimum: 1, maximum: 100, default: 20 },
58
+ }, { in: 'query', name: 'cursor', schema: { type: 'string' } });
59
+ if (route.method === 'post')
60
+ parameters.push({
61
+ in: 'header',
62
+ name: 'Idempotency-Key',
63
+ required: true,
64
+ schema: { type: 'string', format: 'uuid' },
65
+ });
66
+ paths[route.path][route.method] = {
67
+ operationId: route.operationId,
68
+ security: [{ oxySession: [] }],
69
+ parameters,
70
+ ...('body' in route
71
+ ? {
72
+ requestBody: {
73
+ required: true,
74
+ content: { 'application/json': { schema: z.toJSONSchema(route.body) } },
75
+ },
76
+ }
77
+ : {}),
78
+ responses: {
79
+ [route.status]: {
80
+ description: 'Success',
81
+ content: { 'application/json': { schema: z.toJSONSchema(route.response) } },
82
+ },
83
+ default: {
84
+ description: 'Peable error envelope; HTTP status identifies failure',
85
+ content: {
86
+ 'application/json': {
87
+ schema: {
88
+ type: 'object',
89
+ required: ['error'],
90
+ properties: {
91
+ error: {
92
+ type: 'object',
93
+ required: ['type', 'message'],
94
+ properties: { type: { type: 'string' }, message: { type: 'string' } },
95
+ },
96
+ },
97
+ },
98
+ },
99
+ },
100
+ },
101
+ },
102
+ };
103
+ }
104
+ return {
105
+ openapi: '3.1.0',
106
+ info: {
107
+ title: 'Peable organization contributions',
108
+ version: '0.1.0',
109
+ description: 'One-off links. Human Oxy session for management; existing /v1/payment_links/{id}/public and /payment_intent remain anonymous. Fixed/free amounts use FAIR base units (8 decimals); the registered merchant determines the network. Refunds cannot be created by the watch-only gateway. No recurring billing.',
110
+ },
111
+ servers: [{ url: 'https://api.peable.to' }],
112
+ components: { securitySchemes: { oxySession: { type: 'http', scheme: 'bearer' } } },
113
+ paths,
114
+ };
115
+ }
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,119 @@
1
+ import { z } from 'zod';
2
+ export declare const contributionAmountSchema: z.ZodString;
3
+ export declare const contributionDetailsSchema: z.ZodObject<{
4
+ organizationId: z.ZodString;
5
+ purpose: z.ZodString;
6
+ amountMode: z.ZodEnum<{
7
+ fixed: "fixed";
8
+ free: "free";
9
+ }>;
10
+ expiresAt: z.ZodNullable<z.ZodISODateTime>;
11
+ }, z.core.$strict>;
12
+ export type ContributionDetails = z.infer<typeof contributionDetailsSchema>;
13
+ export declare const createContributionSchema: z.ZodObject<{
14
+ purpose: z.ZodString;
15
+ amountMode: z.ZodEnum<{
16
+ fixed: "fixed";
17
+ free: "free";
18
+ }>;
19
+ amount: z.ZodOptional<z.ZodString>;
20
+ currency: z.ZodLiteral<"FAIR">;
21
+ expiresAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
22
+ }, z.core.$strict>;
23
+ export type CreateContribution = z.infer<typeof createContributionSchema>;
24
+ export declare const contributionLinkSchema: z.ZodObject<{
25
+ id: z.ZodString;
26
+ amount: z.ZodString;
27
+ currency: z.ZodLiteral<"FAIR">;
28
+ network: z.ZodEnum<{
29
+ mainnet: "mainnet";
30
+ testnet: "testnet";
31
+ }>;
32
+ active: z.ZodBoolean;
33
+ url: z.ZodURL;
34
+ contribution: z.ZodObject<{
35
+ organizationId: z.ZodString;
36
+ purpose: z.ZodString;
37
+ amountMode: z.ZodEnum<{
38
+ fixed: "fixed";
39
+ free: "free";
40
+ }>;
41
+ expiresAt: z.ZodNullable<z.ZodISODateTime>;
42
+ }, z.core.$strict>;
43
+ createdAt: z.ZodISODateTime;
44
+ }, z.core.$strict>;
45
+ export type ContributionLink = z.infer<typeof contributionLinkSchema>;
46
+ export declare const contributionListSchema: z.ZodObject<{
47
+ items: z.ZodArray<z.ZodObject<{
48
+ id: z.ZodString;
49
+ amount: z.ZodString;
50
+ currency: z.ZodLiteral<"FAIR">;
51
+ network: z.ZodEnum<{
52
+ mainnet: "mainnet";
53
+ testnet: "testnet";
54
+ }>;
55
+ active: z.ZodBoolean;
56
+ url: z.ZodURL;
57
+ contribution: z.ZodObject<{
58
+ organizationId: z.ZodString;
59
+ purpose: z.ZodString;
60
+ amountMode: z.ZodEnum<{
61
+ fixed: "fixed";
62
+ free: "free";
63
+ }>;
64
+ expiresAt: z.ZodNullable<z.ZodISODateTime>;
65
+ }, z.core.$strict>;
66
+ createdAt: z.ZodISODateTime;
67
+ }, z.core.$strict>>;
68
+ nextCursor: z.ZodNullable<z.ZodString>;
69
+ }, z.core.$strict>;
70
+ export declare const contributionCollectionSchema: z.ZodObject<{
71
+ id: z.ZodString;
72
+ amount: z.ZodString;
73
+ currency: z.ZodLiteral<"FAIR">;
74
+ status: z.ZodString;
75
+ createdAt: z.ZodISODateTime;
76
+ refundCapability: z.ZodLiteral<"unsupported_non_custodial">;
77
+ refunds: z.ZodArray<z.ZodObject<{
78
+ id: z.ZodString;
79
+ amount: z.ZodString;
80
+ status: z.ZodString;
81
+ createdAt: z.ZodISODateTime;
82
+ }, z.core.$strict>>;
83
+ }, z.core.$strict>;
84
+ export declare const contributionCollectionListSchema: z.ZodObject<{
85
+ items: z.ZodArray<z.ZodObject<{
86
+ id: z.ZodString;
87
+ amount: z.ZodString;
88
+ currency: z.ZodLiteral<"FAIR">;
89
+ status: z.ZodString;
90
+ createdAt: z.ZodISODateTime;
91
+ refundCapability: z.ZodLiteral<"unsupported_non_custodial">;
92
+ refunds: z.ZodArray<z.ZodObject<{
93
+ id: z.ZodString;
94
+ amount: z.ZodString;
95
+ status: z.ZodString;
96
+ createdAt: z.ZodISODateTime;
97
+ }, z.core.$strict>>;
98
+ }, z.core.$strict>>;
99
+ nextCursor: z.ZodNullable<z.ZodString>;
100
+ }, z.core.$strict>;
101
+ export declare const contributionPageQuerySchema: z.ZodObject<{
102
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
103
+ cursor: z.ZodOptional<z.ZodString>;
104
+ environment: z.ZodEnum<{
105
+ development: "development";
106
+ staging: "staging";
107
+ production: "production";
108
+ }>;
109
+ }, z.core.$strict>;
110
+ export declare const contributionMintSchema: z.ZodObject<{
111
+ amount: z.ZodOptional<z.ZodString>;
112
+ }, z.core.$strict>;
113
+ export declare const contributionOperationKeySchema: z.ZodString;
114
+ export declare const contributionPatchSchema: z.ZodObject<{
115
+ active: z.ZodBoolean;
116
+ }, z.core.$strict>;
117
+ export declare function decimalContributionAmount(value: string): string;
118
+ export declare function formatContributionAmount(value: string): string;
119
+ export type ContributionCollectionList = z.infer<typeof contributionCollectionListSchema>;
@@ -0,0 +1,138 @@
1
+ import { z } from 'zod';
2
+ export declare const contributionRoutes: readonly [{
3
+ readonly method: "post";
4
+ readonly path: "/v1/organizations/{organizationId}/applications/{applicationId}/contributions";
5
+ readonly operationId: "createContribution";
6
+ readonly body: z.ZodObject<{
7
+ purpose: z.ZodString;
8
+ amountMode: z.ZodEnum<{
9
+ fixed: "fixed";
10
+ free: "free";
11
+ }>;
12
+ amount: z.ZodOptional<z.ZodString>;
13
+ currency: z.ZodLiteral<"FAIR">;
14
+ expiresAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
15
+ }, z.core.$strict>;
16
+ readonly response: z.ZodObject<{
17
+ id: z.ZodString;
18
+ amount: z.ZodString;
19
+ currency: z.ZodLiteral<"FAIR">;
20
+ network: z.ZodEnum<{
21
+ mainnet: "mainnet";
22
+ testnet: "testnet";
23
+ }>;
24
+ active: z.ZodBoolean;
25
+ url: z.ZodURL;
26
+ contribution: z.ZodObject<{
27
+ organizationId: z.ZodString;
28
+ purpose: z.ZodString;
29
+ amountMode: z.ZodEnum<{
30
+ fixed: "fixed";
31
+ free: "free";
32
+ }>;
33
+ expiresAt: z.ZodNullable<z.ZodISODateTime>;
34
+ }, z.core.$strict>;
35
+ createdAt: z.ZodISODateTime;
36
+ }, z.core.$strict>;
37
+ readonly status: 201;
38
+ }, {
39
+ readonly method: "get";
40
+ readonly path: "/v1/organizations/{organizationId}/applications/{applicationId}/contributions";
41
+ readonly operationId: "listContributions";
42
+ readonly response: z.ZodObject<{
43
+ items: z.ZodArray<z.ZodObject<{
44
+ id: z.ZodString;
45
+ amount: z.ZodString;
46
+ currency: z.ZodLiteral<"FAIR">;
47
+ network: z.ZodEnum<{
48
+ mainnet: "mainnet";
49
+ testnet: "testnet";
50
+ }>;
51
+ active: z.ZodBoolean;
52
+ url: z.ZodURL;
53
+ contribution: z.ZodObject<{
54
+ organizationId: z.ZodString;
55
+ purpose: z.ZodString;
56
+ amountMode: z.ZodEnum<{
57
+ fixed: "fixed";
58
+ free: "free";
59
+ }>;
60
+ expiresAt: z.ZodNullable<z.ZodISODateTime>;
61
+ }, z.core.$strict>;
62
+ createdAt: z.ZodISODateTime;
63
+ }, z.core.$strict>>;
64
+ nextCursor: z.ZodNullable<z.ZodString>;
65
+ }, z.core.$strict>;
66
+ readonly status: 200;
67
+ }, {
68
+ readonly method: "patch";
69
+ readonly path: "/v1/organizations/{organizationId}/applications/{applicationId}/contributions/{id}";
70
+ readonly operationId: "setContributionActive";
71
+ readonly body: z.ZodObject<{
72
+ active: z.ZodBoolean;
73
+ }, z.core.$strict>;
74
+ readonly response: z.ZodObject<{
75
+ id: z.ZodString;
76
+ amount: z.ZodString;
77
+ currency: z.ZodLiteral<"FAIR">;
78
+ network: z.ZodEnum<{
79
+ mainnet: "mainnet";
80
+ testnet: "testnet";
81
+ }>;
82
+ active: z.ZodBoolean;
83
+ url: z.ZodURL;
84
+ contribution: z.ZodObject<{
85
+ organizationId: z.ZodString;
86
+ purpose: z.ZodString;
87
+ amountMode: z.ZodEnum<{
88
+ fixed: "fixed";
89
+ free: "free";
90
+ }>;
91
+ expiresAt: z.ZodNullable<z.ZodISODateTime>;
92
+ }, z.core.$strict>;
93
+ createdAt: z.ZodISODateTime;
94
+ }, z.core.$strict>;
95
+ readonly status: 200;
96
+ }, {
97
+ readonly method: "get";
98
+ readonly path: "/v1/organizations/{organizationId}/applications/{applicationId}/contributions/{id}/collections";
99
+ readonly operationId: "listContributionCollections";
100
+ readonly response: z.ZodObject<{
101
+ items: z.ZodArray<z.ZodObject<{
102
+ id: z.ZodString;
103
+ amount: z.ZodString;
104
+ currency: z.ZodLiteral<"FAIR">;
105
+ status: z.ZodString;
106
+ createdAt: z.ZodISODateTime;
107
+ refundCapability: z.ZodLiteral<"unsupported_non_custodial">;
108
+ refunds: z.ZodArray<z.ZodObject<{
109
+ id: z.ZodString;
110
+ amount: z.ZodString;
111
+ status: z.ZodString;
112
+ createdAt: z.ZodISODateTime;
113
+ }, z.core.$strict>>;
114
+ }, z.core.$strict>>;
115
+ nextCursor: z.ZodNullable<z.ZodString>;
116
+ }, z.core.$strict>;
117
+ readonly status: 200;
118
+ }];
119
+ export declare function contributionOpenApi(): {
120
+ openapi: string;
121
+ info: {
122
+ title: string;
123
+ version: string;
124
+ description: string;
125
+ };
126
+ servers: {
127
+ url: string;
128
+ }[];
129
+ components: {
130
+ securitySchemes: {
131
+ oxySession: {
132
+ type: string;
133
+ scheme: string;
134
+ };
135
+ };
136
+ };
137
+ paths: Record<string, Record<string, unknown>>;
138
+ };
package/package.json CHANGED
@@ -1,6 +1,78 @@
1
1
  {
2
2
  "name": "@peable.to/contracts",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.0",
4
+ "description": "Validated Peable contribution-link contracts",
5
+ "main": "dist/cjs/index.js",
6
+ "module": "dist/esm/index.js",
7
+ "types": "dist/types/index.d.ts",
8
+ "source": "src/index.ts",
9
+ "sideEffects": false,
10
+ "publishConfig": {
11
+ "access": "public",
12
+ "registry": "https://registry.npmjs.org/"
13
+ },
14
+ "exports": {
15
+ ".": {
16
+ "react-native": "./dist/esm/index.js",
17
+ "import": {
18
+ "types": "./dist/types/index.d.ts",
19
+ "default": "./dist/esm/index.js"
20
+ },
21
+ "require": {
22
+ "types": "./dist/types/index.d.ts",
23
+ "default": "./dist/cjs/index.js"
24
+ },
25
+ "default": "./dist/esm/index.js"
26
+ },
27
+ "./package.json": "./package.json",
28
+ "./openapi": {
29
+ "import": {
30
+ "types": "./dist/types/openapi.d.ts",
31
+ "default": "./dist/esm/openapi.js"
32
+ },
33
+ "require": {
34
+ "types": "./dist/types/openapi.d.ts",
35
+ "default": "./dist/cjs/openapi.js"
36
+ }
37
+ }
38
+ },
39
+ "files": [
40
+ "dist"
41
+ ],
42
+ "keywords": [
43
+ "peable",
44
+ "gateway",
45
+ "payments",
46
+ "types"
47
+ ],
48
+ "repository": {
49
+ "type": "git",
50
+ "url": "https://github.com/OxyHQ/Peable.git",
51
+ "directory": "packages/contracts"
52
+ },
53
+ "author": "Peable",
54
+ "license": "MIT",
55
+ "homepage": "https://peable.to",
56
+ "engines": {
57
+ "node": ">=18.0.0"
58
+ },
59
+ "scripts": {
60
+ "build": "bun run build:cjs && bun run build:esm && bun run build:types",
61
+ "build:cjs": "tsc -p tsconfig.cjs.json",
62
+ "build:esm": "tsc -p tsconfig.esm.json && node scripts/fix-esm-imports.mjs",
63
+ "build:types": "tsc -p tsconfig.types.json",
64
+ "clean": "rm -rf dist",
65
+ "dev": "tsc --watch",
66
+ "typecheck": "tsc --noEmit",
67
+ "test": "bun test",
68
+ "prepublishOnly": "bun run clean && bun run typecheck && bun run test && bun run build"
69
+ },
70
+ "devDependencies": {
71
+ "typescript": "~5.9.2",
72
+ "@types/node": "^20.0.0",
73
+ "@types/bun": "latest"
74
+ },
75
+ "dependencies": {
76
+ "zod": "^4.3.6"
77
+ }
78
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.