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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,064 changes: 1,060 additions & 4 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions packages/connect-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,12 @@ export {
export type {
CreateEscrowParams,
CreateQuoteParams,
DepositParams,
Escrow,
EscrowStatus,
EscrowStatusResponse,
FiatPaymentMethod,
FiatReceiptParams,
Listing,
PactoApiClient,
Quote,
Expand Down
32 changes: 32 additions & 0 deletions packages/connect-core/src/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,20 @@ export interface CreateEscrowParams {
quoteId: string;
}

export interface DepositParams {
/** When true, simulates on-chain deposit in Gateway test mode. */
testMode?: boolean;
}

export type FiatPaymentMethod = 'SINPE' | 'SPEI';

export interface FiatReceiptParams {
method: FiatPaymentMethod;
reference: string;
/** Base64-encoded receipt image or document. */
receipt?: string;
}

export interface ListingsResource {
list(): Promise<{ listings: Listing[] }>;
retrieve(id: string): Promise<{ listing: Listing }>;
Expand All @@ -65,6 +79,8 @@ export interface EscrowsResource {
create(params: CreateEscrowParams): Promise<{ escrow: Escrow }>;
retrieve(id: string): Promise<{ escrow: Escrow }>;
getStatus(id: string): Promise<{ status: EscrowStatusResponse }>;
deposit(id: string, params?: DepositParams): Promise<{ escrow: Escrow }>;
reportFiatPayment(id: string, params: FiatReceiptParams): Promise<{ escrow: Escrow }>;
}

export interface PactoApiClient {
Expand Down Expand Up @@ -122,6 +138,22 @@ export function createApiClient(options: HttpClientOptions): PactoApiClient {
path: `/v1/escrows/${id}/status`,
resource: 'escrow',
}),
deposit: (id, params = {}) =>
request<{ escrow: Escrow }>(options, {
method: 'POST',
path: `/v1/escrows/${id}/deposit`,
body: params,
idempotent: true,
resource: 'escrow',
}),
reportFiatPayment: (id, params) =>
request<{ escrow: Escrow }>(options, {
method: 'POST',
path: `/v1/escrows/${id}/fiat-receipt`,
body: params,
idempotent: true,
resource: 'escrow',
}),
},
};
}
6 changes: 6 additions & 0 deletions packages/connect-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,14 @@
"@pacto-connect/core": "*"
},
"devDependencies": {
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.1.0",
"@testing-library/user-event": "^14.5.2",
"@types/react": "^19.0.1",
"@types/react-dom": "^19.0.2",
"jsdom": "^25.0.1",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"tsup": "^8.3.5",
"typescript": "^5.6.3"
}
Expand Down
Loading
Loading