veilioexchange 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.
- package/LICENSE +21 -0
- package/README.md +159 -2
- package/dist/cjs/auth.d.ts +31 -0
- package/dist/cjs/auth.d.ts.map +1 -0
- package/dist/cjs/auth.js +42 -0
- package/dist/cjs/auth.js.map +1 -0
- package/dist/cjs/deployments.d.ts +21 -0
- package/dist/cjs/deployments.d.ts.map +1 -0
- package/dist/cjs/deployments.js +23 -0
- package/dist/cjs/deployments.js.map +1 -0
- package/dist/cjs/errors.d.ts +33 -0
- package/dist/cjs/errors.d.ts.map +1 -0
- package/dist/cjs/errors.js +51 -0
- package/dist/cjs/errors.js.map +1 -0
- package/dist/cjs/index.d.ts +545 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +770 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/solana/auction.d.ts +180 -0
- package/dist/cjs/solana/auction.d.ts.map +1 -0
- package/dist/cjs/solana/auction.js +457 -0
- package/dist/cjs/solana/auction.js.map +1 -0
- package/dist/cjs/solana/client.d.ts +75 -0
- package/dist/cjs/solana/client.d.ts.map +1 -0
- package/dist/cjs/solana/client.js +281 -0
- package/dist/cjs/solana/client.js.map +1 -0
- package/dist/cjs/solana/escrow.d.ts +140 -0
- package/dist/cjs/solana/escrow.d.ts.map +1 -0
- package/dist/cjs/solana/escrow.js +354 -0
- package/dist/cjs/solana/escrow.js.map +1 -0
- package/dist/cjs/solana/index.d.ts +9 -0
- package/dist/cjs/solana/index.d.ts.map +1 -0
- package/dist/cjs/solana/index.js +32 -0
- package/dist/cjs/solana/index.js.map +1 -0
- package/dist/cjs/solana/registry.d.ts +100 -0
- package/dist/cjs/solana/registry.d.ts.map +1 -0
- package/dist/cjs/solana/registry.js +278 -0
- package/dist/cjs/solana/registry.js.map +1 -0
- package/dist/esm/auth.d.ts +31 -0
- package/dist/esm/auth.d.ts.map +1 -0
- package/dist/esm/auth.js +37 -0
- package/dist/esm/auth.js.map +1 -0
- package/dist/esm/deployments.d.ts +21 -0
- package/dist/esm/deployments.d.ts.map +1 -0
- package/dist/esm/deployments.js +20 -0
- package/dist/esm/deployments.js.map +1 -0
- package/dist/esm/errors.d.ts +33 -0
- package/dist/esm/errors.d.ts.map +1 -0
- package/dist/esm/errors.js +45 -0
- package/dist/esm/errors.js.map +1 -0
- package/dist/esm/index.d.ts +545 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +748 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/solana/auction.d.ts +180 -0
- package/dist/esm/solana/auction.d.ts.map +1 -0
- package/dist/esm/solana/auction.js +438 -0
- package/dist/esm/solana/auction.js.map +1 -0
- package/dist/esm/solana/client.d.ts +75 -0
- package/dist/esm/solana/client.d.ts.map +1 -0
- package/dist/esm/solana/client.js +274 -0
- package/dist/esm/solana/client.js.map +1 -0
- package/dist/esm/solana/escrow.d.ts +140 -0
- package/dist/esm/solana/escrow.d.ts.map +1 -0
- package/dist/esm/solana/escrow.js +339 -0
- package/dist/esm/solana/escrow.js.map +1 -0
- package/dist/esm/solana/index.d.ts +9 -0
- package/dist/esm/solana/index.d.ts.map +1 -0
- package/dist/esm/solana/index.js +9 -0
- package/dist/esm/solana/index.js.map +1 -0
- package/dist/esm/solana/registry.d.ts +100 -0
- package/dist/esm/solana/registry.d.ts.map +1 -0
- package/dist/esm/solana/registry.js +264 -0
- package/dist/esm/solana/registry.js.map +1 -0
- package/package.json +79 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 VEILIO
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,160 @@
|
|
|
1
|
-
#
|
|
1
|
+
# veilioexchange
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
TypeScript SDK for **VEILIO**: sealed-bid auctions for digital assets and milestone service escrow, built on [viem](https://viem.sh).
|
|
4
|
+
|
|
5
|
+
- **Networks:** BNB Smart Chain Testnet (97), Base Sepolia (84532) and Solana Devnet. Testnet only.
|
|
6
|
+
- **Formats:** ESM and CommonJS, with TypeScript types.
|
|
7
|
+
- **Runtime:** Node.js 18+ or any modern browser.
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install veilioexchange viem
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
`viem` is a peer dependency, so your app and the SDK share one copy.
|
|
14
|
+
|
|
15
|
+
## Auctions
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { createPublicClient, createWalletClient, http } from 'viem';
|
|
19
|
+
import { bscTestnet } from 'viem/chains';
|
|
20
|
+
import { privateKeyToAccount } from 'viem/accounts';
|
|
21
|
+
import { createVeilioAgent } from 'veilioexchange';
|
|
22
|
+
|
|
23
|
+
const account = privateKeyToAccount(process.env.AGENT_PRIVATE_KEY as `0x${string}`);
|
|
24
|
+
const publicClient = createPublicClient({ chain: bscTestnet, transport: http() });
|
|
25
|
+
const walletClient = createWalletClient({ account, chain: bscTestnet, transport: http() });
|
|
26
|
+
|
|
27
|
+
const agent = createVeilioAgent({
|
|
28
|
+
publicClient,
|
|
29
|
+
walletClient,
|
|
30
|
+
account: account.address,
|
|
31
|
+
apiBaseUrl: 'https://your-veilio-host', // needed for searchAssets / getAssetDetails
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const { auctions } = await agent.listAuctions({ limit: 20 });
|
|
35
|
+
const auctionId = auctions[0].id;
|
|
36
|
+
|
|
37
|
+
// Sealed bid: random 32-byte secret + keccak256 commitment, computed locally.
|
|
38
|
+
const bid = agent.prepareBid(auctionId, '0.05'); // max bid in BNB
|
|
39
|
+
// Store `bid` (including bid.secret) somewhere durable and encrypted.
|
|
40
|
+
// If the secret is lost the bid can never be revealed.
|
|
41
|
+
|
|
42
|
+
await agent.commitBid(bid, '0.08'); // deposit >= max bid; over-deposit to hide your ceiling
|
|
43
|
+
await agent.revealBid(bid); // during the Revealing window
|
|
44
|
+
|
|
45
|
+
const result = await agent.getAuctionResult(auctionId);
|
|
46
|
+
if (result.isWinner) await agent.claimAsset(auctionId);
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Services escrow
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
import { createVeilioServicesClient, signServiceAuth } from 'veilioexchange';
|
|
53
|
+
|
|
54
|
+
const services = createVeilioServicesClient({
|
|
55
|
+
publicClient,
|
|
56
|
+
walletClient,
|
|
57
|
+
account: account.address,
|
|
58
|
+
chainId: 97, // or 84532 for Base Sepolia (use matching viem clients)
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const orderId = 'srv-order-uuid-101';
|
|
62
|
+
|
|
63
|
+
const deposit = await services.deposit({
|
|
64
|
+
orderId,
|
|
65
|
+
seller: '0xSeller...',
|
|
66
|
+
deadline: Math.floor(Date.now() / 1000) + 3 * 86400,
|
|
67
|
+
amount: '0.25',
|
|
68
|
+
});
|
|
69
|
+
await deposit.wait();
|
|
70
|
+
|
|
71
|
+
const order = await services.getOrder(orderId); // status: 'Funded'
|
|
72
|
+
await (await services.submitDelivery(orderId, 'ipfs://QmProof')).wait(); // seller
|
|
73
|
+
await (await services.releaseFunds(orderId)).wait(); // buyer; 5% fee on release
|
|
74
|
+
|
|
75
|
+
// Fee-free exits: services.refund(orderId, reason), services.refundTimeout(orderId),
|
|
76
|
+
// services.dispute(orderId, reason)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Signed API calls
|
|
80
|
+
|
|
81
|
+
Off-chain order actions on the VEILIO API carry an EIP-191 signature:
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
const auth = await signServiceAuth(account, 'verify-deposit', orderId);
|
|
85
|
+
|
|
86
|
+
await fetch(`https://your-veilio-host/api/orders/${orderId}/verify-deposit`, {
|
|
87
|
+
method: 'POST',
|
|
88
|
+
headers: { 'Content-Type': 'application/json' },
|
|
89
|
+
body: JSON.stringify({ txHash: deposit.txHash, network: 'bnb:97', auth }),
|
|
90
|
+
});
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Solana Devnet
|
|
94
|
+
|
|
95
|
+
Solana lives in its own entry point so EVM-only users never load `@solana/web3.js`:
|
|
96
|
+
|
|
97
|
+
```sh
|
|
98
|
+
npm install veilioexchange @solana/web3.js
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
```ts
|
|
102
|
+
import { Connection, Keypair, clusterApiUrl } from '@solana/web3.js';
|
|
103
|
+
import { createVeilioSolanaClient, keypairSigner } from 'veilioexchange/solana';
|
|
104
|
+
|
|
105
|
+
const connection = new Connection(clusterApiUrl('devnet'), 'confirmed');
|
|
106
|
+
const agentKey = Keypair.fromSecretKey(/* load your devnet key from a secret store */);
|
|
107
|
+
|
|
108
|
+
const solana = createVeilioSolanaClient({
|
|
109
|
+
connection,
|
|
110
|
+
signer: keypairSigner(agentKey), // or a Phantom provider: window.phantom.solana
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
// Sealed-bid auction
|
|
114
|
+
const auctions = await solana.listAuctions();
|
|
115
|
+
const bid = solana.prepareBid(auctions[0].auctionId, '0.25'); // max bid in SOL
|
|
116
|
+
// Store `bid` (salt included) in encrypted storage before committing.
|
|
117
|
+
await solana.commitBid(bid, '0.3');
|
|
118
|
+
await solana.revealBid(bid);
|
|
119
|
+
|
|
120
|
+
// Service escrow
|
|
121
|
+
await solana.deposit({
|
|
122
|
+
orderId: 'ord-1739-abc12', // up to 32 bytes, or 32-byte hex
|
|
123
|
+
seller: 'SellerBase58...',
|
|
124
|
+
reviewer: 'ReviewerWallet...', // a wallet that can sign, never a program ID
|
|
125
|
+
feeRecipient: 'FeeWallet...',
|
|
126
|
+
amountSol: '1.5',
|
|
127
|
+
deadline: Math.floor(Date.now() / 1000) + 3 * 86400,
|
|
128
|
+
});
|
|
129
|
+
await solana.submitDelivery('ord-1739-abc12', 'ipfs://QmProof'); // seller
|
|
130
|
+
await solana.releaseFunds('ord-1739-abc12'); // buyer
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Solana support needs Node.js 18+ (it uses `node:crypto`). Base58 addresses are case-sensitive; never lowercase them.
|
|
134
|
+
|
|
135
|
+
| Program (Devnet) | ID |
|
|
136
|
+
|---|---|
|
|
137
|
+
| Auction | `5Tw1iJGN1hhyRzepbD5eLoaRoZTEiKcqrh2HoZYhYEta` |
|
|
138
|
+
| Service escrow | `5Vj4y8BT74PDe5VwLuDp9agTR5ak4vtZdwxnBfRW3R8s` |
|
|
139
|
+
|
|
140
|
+
## Contract addresses
|
|
141
|
+
|
|
142
|
+
Defaults live in `VEILIO_DEPLOYMENTS`. Every client takes a `contractAddress` option to point at your own deployment.
|
|
143
|
+
|
|
144
|
+
| Network | Auction | Service escrow |
|
|
145
|
+
|---|---|---|
|
|
146
|
+
| BNB Testnet (97) | `0xc12EcD53B9dAE1753409B87f10Bf00684BF7d8B1` | `0x794f1610B5588a55B19D8c82e4381448a388C965` |
|
|
147
|
+
| Base Sepolia (84532) | `0x2a56D1a2C8Ffc63b0b009fceEa9d8d182A17A025` | `0x13C16c508780639E86cA9d4322Ba9739C15e78Af` |
|
|
148
|
+
|
|
149
|
+
## Errors
|
|
150
|
+
|
|
151
|
+
Failures are thrown as `VeilioSdkError` with a typed `code` (`INVALID_INPUT`, `CHAIN_MISMATCH`, `WALLET_REQUIRED`, `TRANSACTION_REVERTED`, ...) and a `retryable` flag.
|
|
152
|
+
|
|
153
|
+
## Security
|
|
154
|
+
|
|
155
|
+
- Use a dedicated testnet wallet for agents and load its key from the environment. Never commit it.
|
|
156
|
+
- Bid deposits and bidder addresses are public on-chain; only the bid value is sealed until reveal.
|
|
157
|
+
|
|
158
|
+
## License
|
|
159
|
+
|
|
160
|
+
MIT
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Address, Hex } from 'viem';
|
|
2
|
+
/** Signed `auth` object expected by VEILIO Services API routes. */
|
|
3
|
+
export interface ServiceAuthPayload {
|
|
4
|
+
address: Address;
|
|
5
|
+
signature: Hex;
|
|
6
|
+
timestamp: number;
|
|
7
|
+
nonce: string;
|
|
8
|
+
}
|
|
9
|
+
/** Anything that can produce an EIP-191 personal_sign signature (a viem LocalAccount works). */
|
|
10
|
+
export interface MessageSigner {
|
|
11
|
+
address: Address;
|
|
12
|
+
signMessage: (args: {
|
|
13
|
+
message: string;
|
|
14
|
+
}) => Promise<Hex>;
|
|
15
|
+
}
|
|
16
|
+
/** Random 16-hex-character nonce from a cryptographically secure source. */
|
|
17
|
+
export declare function generateAuthNonce(): string;
|
|
18
|
+
/** Exact message the VEILIO API verifies; must match the server byte-for-byte. */
|
|
19
|
+
export declare function createServiceAuthMessage(input: {
|
|
20
|
+
action: string;
|
|
21
|
+
orderId: string;
|
|
22
|
+
address: string;
|
|
23
|
+
timestamp: number;
|
|
24
|
+
nonce: string;
|
|
25
|
+
}): string;
|
|
26
|
+
/**
|
|
27
|
+
* Builds the signed `auth` payload for an off-chain Services action
|
|
28
|
+
* (e.g. 'accept-payment-request', 'verify-deposit', 'submit', 'revision', 'approve', 'cancel').
|
|
29
|
+
*/
|
|
30
|
+
export declare function signServiceAuth(signer: MessageSigner, action: string, orderId: string): Promise<ServiceAuthPayload>;
|
|
31
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAGzC,mEAAmE;AACnE,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,GAAG,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,gGAAgG;AAChG,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;CAC1D;AAED,4EAA4E;AAC5E,wBAAgB,iBAAiB,IAAI,MAAM,CAU1C;AAED,kFAAkF;AAClF,wBAAgB,wBAAwB,CAAC,KAAK,EAAE;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,MAAM,CAUT;AAED;;;GAGG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,kBAAkB,CAAC,CAM7B"}
|
package/dist/cjs/auth.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateAuthNonce = generateAuthNonce;
|
|
4
|
+
exports.createServiceAuthMessage = createServiceAuthMessage;
|
|
5
|
+
exports.signServiceAuth = signServiceAuth;
|
|
6
|
+
const errors_js_1 = require("./errors.js");
|
|
7
|
+
/** Random 16-hex-character nonce from a cryptographically secure source. */
|
|
8
|
+
function generateAuthNonce() {
|
|
9
|
+
const cryptoApi = globalThis.crypto;
|
|
10
|
+
if (!cryptoApi?.getRandomValues) {
|
|
11
|
+
throw new errors_js_1.VeilioSdkError({
|
|
12
|
+
code: 'INVALID_CONFIG',
|
|
13
|
+
message: 'A cryptographically secure random generator is required to create an auth nonce.',
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
const bytes = cryptoApi.getRandomValues(new Uint8Array(8));
|
|
17
|
+
return Array.from(bytes, (byte) => byte.toString(16).padStart(2, '0')).join('');
|
|
18
|
+
}
|
|
19
|
+
/** Exact message the VEILIO API verifies; must match the server byte-for-byte. */
|
|
20
|
+
function createServiceAuthMessage(input) {
|
|
21
|
+
return [
|
|
22
|
+
'VEILIO SERVICES AUTHORIZATION V1',
|
|
23
|
+
`Action: ${input.action}`,
|
|
24
|
+
`Order ID: ${input.orderId}`,
|
|
25
|
+
`Wallet: ${input.address.toLowerCase()}`,
|
|
26
|
+
`Timestamp: ${input.timestamp}`,
|
|
27
|
+
`Nonce: ${input.nonce}`,
|
|
28
|
+
'Purpose: Authorize off-chain state change for VEILIO Services escrow.',
|
|
29
|
+
].join('\n');
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Builds the signed `auth` payload for an off-chain Services action
|
|
33
|
+
* (e.g. 'accept-payment-request', 'verify-deposit', 'submit', 'revision', 'approve', 'cancel').
|
|
34
|
+
*/
|
|
35
|
+
async function signServiceAuth(signer, action, orderId) {
|
|
36
|
+
const timestamp = Date.now();
|
|
37
|
+
const nonce = generateAuthNonce();
|
|
38
|
+
const message = createServiceAuthMessage({ action, orderId, address: signer.address, timestamp, nonce });
|
|
39
|
+
const signature = await signer.signMessage({ message });
|
|
40
|
+
return { address: signer.address, signature, timestamp, nonce };
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/auth.ts"],"names":[],"mappings":";;AAkBA,8CAUC;AAGD,4DAgBC;AAMD,0CAUC;AA9DD,2CAA6C;AAgB7C,4EAA4E;AAC5E,SAAgB,iBAAiB;IAC/B,MAAM,SAAS,GAAG,UAAU,CAAC,MAAM,CAAC;IACpC,IAAI,CAAC,SAAS,EAAE,eAAe,EAAE,CAAC;QAChC,MAAM,IAAI,0BAAc,CAAC;YACvB,IAAI,EAAE,gBAAgB;YACtB,OAAO,EAAE,kFAAkF;SAC5F,CAAC,CAAC;IACL,CAAC;IACD,MAAM,KAAK,GAAG,SAAS,CAAC,eAAe,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3D,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAClF,CAAC;AAED,kFAAkF;AAClF,SAAgB,wBAAwB,CAAC,KAMxC;IACC,OAAO;QACL,kCAAkC;QAClC,WAAW,KAAK,CAAC,MAAM,EAAE;QACzB,aAAa,KAAK,CAAC,OAAO,EAAE;QAC5B,WAAW,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE;QACxC,cAAc,KAAK,CAAC,SAAS,EAAE;QAC/B,UAAU,KAAK,CAAC,KAAK,EAAE;QACvB,uEAAuE;KACxE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED;;;GAGG;AACI,KAAK,UAAU,eAAe,CACnC,MAAqB,EACrB,MAAc,EACd,OAAe;IAEf,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAC7B,MAAM,KAAK,GAAG,iBAAiB,EAAE,CAAC;IAClC,MAAM,OAAO,GAAG,wBAAwB,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;IACzG,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;IACxD,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;AAClE,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Address } from 'viem';
|
|
2
|
+
/**
|
|
3
|
+
* Known VEILIO testnet deployments. Every client accepts an explicit
|
|
4
|
+
* `contractAddress`, so these are defaults only; override them when you
|
|
5
|
+
* point the SDK at your own deployment.
|
|
6
|
+
*/
|
|
7
|
+
export declare const VEILIO_DEPLOYMENTS: {
|
|
8
|
+
readonly bnbTestnet: {
|
|
9
|
+
readonly chainId: 97;
|
|
10
|
+
readonly auction: Address;
|
|
11
|
+
readonly serviceEscrow: Address;
|
|
12
|
+
readonly serviceRegistry: Address;
|
|
13
|
+
};
|
|
14
|
+
readonly baseSepolia: {
|
|
15
|
+
readonly chainId: 84532;
|
|
16
|
+
readonly auction: Address;
|
|
17
|
+
readonly serviceEscrow: Address;
|
|
18
|
+
readonly serviceRegistry: Address;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=deployments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployments.d.ts","sourceRoot":"","sources":["../../src/deployments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAEpC;;;;GAIG;AACH,eAAO,MAAM,kBAAkB;;;0BAG8B,OAAO;gCACD,OAAO;kCACL,OAAO;;;;0BAIf,OAAO;gCACD,OAAO;kCACL,OAAO;;CAElE,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VEILIO_DEPLOYMENTS = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Known VEILIO testnet deployments. Every client accepts an explicit
|
|
6
|
+
* `contractAddress`, so these are defaults only; override them when you
|
|
7
|
+
* point the SDK at your own deployment.
|
|
8
|
+
*/
|
|
9
|
+
exports.VEILIO_DEPLOYMENTS = {
|
|
10
|
+
bnbTestnet: {
|
|
11
|
+
chainId: 97,
|
|
12
|
+
auction: '0xc12EcD53B9dAE1753409B87f10Bf00684BF7d8B1',
|
|
13
|
+
serviceEscrow: '0x794f1610B5588a55B19D8c82e4381448a388C965',
|
|
14
|
+
serviceRegistry: '0x016A23A069180587d5D8B09413e97E1e78ccD702',
|
|
15
|
+
},
|
|
16
|
+
baseSepolia: {
|
|
17
|
+
chainId: 84532,
|
|
18
|
+
auction: '0x2a56D1a2C8Ffc63b0b009fceEa9d8d182A17A025',
|
|
19
|
+
serviceEscrow: '0x13C16c508780639E86cA9d4322Ba9739C15e78Af',
|
|
20
|
+
serviceRegistry: '0x74a6Bf3ed462898F7b3E13e7F4d1c444570bCb88',
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=deployments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployments.js","sourceRoot":"","sources":["../../src/deployments.ts"],"names":[],"mappings":";;;AAEA;;;;GAIG;AACU,QAAA,kBAAkB,GAAG;IAChC,UAAU,EAAE;QACV,OAAO,EAAE,EAAE;QACX,OAAO,EAAE,4CAAuD;QAChE,aAAa,EAAE,4CAAuD;QACtE,eAAe,EAAE,4CAAuD;KACzE;IACD,WAAW,EAAE;QACX,OAAO,EAAE,KAAK;QACd,OAAO,EAAE,4CAAuD;QAChE,aAAa,EAAE,4CAAuD;QACtE,eAAe,EAAE,4CAAuD;KACzE;CACO,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VEILIO Agent SDK — Standardized Error System
|
|
3
|
+
*
|
|
4
|
+
* Provides typed error codes, human-readable messages, retryability metadata,
|
|
5
|
+
* and contextual debugging information for external developers and autonomous agents.
|
|
6
|
+
*/
|
|
7
|
+
export type VeilioErrorCode = 'INVALID_CONFIG' | 'INVALID_INPUT' | 'CHAIN_MISMATCH' | 'WALLET_REQUIRED' | 'WALLET_DISCONNECTED' | 'TRANSACTION_REVERTED' | 'TRANSACTION_TIMEOUT' | 'RPC_ERROR' | 'CONTRACT_ERROR' | 'NOT_FOUND' | 'UNAUTHORIZED';
|
|
8
|
+
export interface VeilioSdkErrorDetails {
|
|
9
|
+
code: VeilioErrorCode;
|
|
10
|
+
message: string;
|
|
11
|
+
retryable?: boolean;
|
|
12
|
+
cause?: unknown;
|
|
13
|
+
context?: Record<string, unknown>;
|
|
14
|
+
}
|
|
15
|
+
export declare class VeilioSdkError extends Error {
|
|
16
|
+
readonly code: VeilioErrorCode;
|
|
17
|
+
readonly retryable: boolean;
|
|
18
|
+
readonly context?: Record<string, unknown>;
|
|
19
|
+
constructor(details: VeilioSdkErrorDetails);
|
|
20
|
+
toJSON(): {
|
|
21
|
+
name: string;
|
|
22
|
+
code: VeilioErrorCode;
|
|
23
|
+
message: string;
|
|
24
|
+
retryable: boolean;
|
|
25
|
+
context: Record<string, unknown> | undefined;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export declare function isVeilioSdkError(error: unknown): error is VeilioSdkError;
|
|
29
|
+
/**
|
|
30
|
+
* Wraps an unknown error into a VeilioSdkError while preserving cause and message.
|
|
31
|
+
*/
|
|
32
|
+
export declare function wrapAsVeilioError(error: unknown, fallbackCode?: VeilioErrorCode, fallbackMessage?: string, retryable?: boolean): VeilioSdkError;
|
|
33
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,MAAM,eAAe,GACvB,gBAAgB,GAChB,eAAe,GACf,gBAAgB,GAChB,iBAAiB,GACjB,qBAAqB,GACrB,sBAAsB,GACtB,qBAAqB,GACrB,WAAW,GACX,gBAAgB,GAChB,WAAW,GACX,cAAc,CAAC;AAEnB,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,eAAe,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,qBAAa,cAAe,SAAQ,KAAK;IACvC,SAAgB,IAAI,EAAE,eAAe,CAAC;IACtC,SAAgB,SAAS,EAAE,OAAO,CAAC;IACnC,SAAgB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBAEtC,OAAO,EAAE,qBAAqB;IAWnC,MAAM;;;;;;;CASd;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,cAAc,CAExE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,OAAO,EACd,YAAY,GAAE,eAA6B,EAC3C,eAAe,SAAqC,EACpD,SAAS,UAAQ,GAChB,cAAc,CAYhB"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* VEILIO Agent SDK — Standardized Error System
|
|
4
|
+
*
|
|
5
|
+
* Provides typed error codes, human-readable messages, retryability metadata,
|
|
6
|
+
* and contextual debugging information for external developers and autonomous agents.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.VeilioSdkError = void 0;
|
|
10
|
+
exports.isVeilioSdkError = isVeilioSdkError;
|
|
11
|
+
exports.wrapAsVeilioError = wrapAsVeilioError;
|
|
12
|
+
class VeilioSdkError extends Error {
|
|
13
|
+
constructor(details) {
|
|
14
|
+
super(details.message, { cause: details.cause });
|
|
15
|
+
this.name = 'VeilioSdkError';
|
|
16
|
+
this.code = details.code;
|
|
17
|
+
this.retryable = details.retryable ?? false;
|
|
18
|
+
this.context = details.context;
|
|
19
|
+
// Maintain proper prototype chain for ES5/ES6 environments
|
|
20
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
21
|
+
}
|
|
22
|
+
toJSON() {
|
|
23
|
+
return {
|
|
24
|
+
name: this.name,
|
|
25
|
+
code: this.code,
|
|
26
|
+
message: this.message,
|
|
27
|
+
retryable: this.retryable,
|
|
28
|
+
context: this.context,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.VeilioSdkError = VeilioSdkError;
|
|
33
|
+
function isVeilioSdkError(error) {
|
|
34
|
+
return error instanceof VeilioSdkError;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Wraps an unknown error into a VeilioSdkError while preserving cause and message.
|
|
38
|
+
*/
|
|
39
|
+
function wrapAsVeilioError(error, fallbackCode = 'RPC_ERROR', fallbackMessage = 'An unexpected SDK error occurred', retryable = false) {
|
|
40
|
+
if (isVeilioSdkError(error)) {
|
|
41
|
+
return error;
|
|
42
|
+
}
|
|
43
|
+
const message = error instanceof Error ? error.message : fallbackMessage;
|
|
44
|
+
return new VeilioSdkError({
|
|
45
|
+
code: fallbackCode,
|
|
46
|
+
message,
|
|
47
|
+
retryable,
|
|
48
|
+
cause: error,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAkDH,4CAEC;AAKD,8CAiBC;AAnDD,MAAa,cAAe,SAAQ,KAAK;IAKvC,YAAY,OAA8B;QACxC,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;QACjD,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,KAAK,CAAC;QAC5C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAE/B,2DAA2D;QAC3D,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACpD,CAAC;IAEM,MAAM;QACX,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAC;IACJ,CAAC;CACF;AAzBD,wCAyBC;AAED,SAAgB,gBAAgB,CAAC,KAAc;IAC7C,OAAO,KAAK,YAAY,cAAc,CAAC;AACzC,CAAC;AAED;;GAEG;AACH,SAAgB,iBAAiB,CAC/B,KAAc,EACd,eAAgC,WAAW,EAC3C,eAAe,GAAG,kCAAkC,EACpD,SAAS,GAAG,KAAK;IAEjB,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;IACzE,OAAO,IAAI,cAAc,CAAC;QACxB,IAAI,EAAE,YAAY;QAClB,OAAO;QACP,SAAS;QACT,KAAK,EAAE,KAAK;KACb,CAAC,CAAC;AACL,CAAC"}
|