@permissionless-technologies/upd-sdk 0.1.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.
Files changed (68) hide show
  1. package/README.md +172 -0
  2. package/dist/chunk-4RBWWS2X.js +6616 -0
  3. package/dist/chunk-4RBWWS2X.js.map +1 -0
  4. package/dist/chunk-4VXNJTNQ.cjs +58 -0
  5. package/dist/chunk-4VXNJTNQ.cjs.map +1 -0
  6. package/dist/chunk-5NNXIJE4.js +16 -0
  7. package/dist/chunk-5NNXIJE4.js.map +1 -0
  8. package/dist/chunk-63FIKV36.js +49 -0
  9. package/dist/chunk-63FIKV36.js.map +1 -0
  10. package/dist/chunk-CZEDT3MS.cjs +62 -0
  11. package/dist/chunk-CZEDT3MS.cjs.map +1 -0
  12. package/dist/chunk-DF34ON56.cjs +18 -0
  13. package/dist/chunk-DF34ON56.cjs.map +1 -0
  14. package/dist/chunk-DJBU2OEB.js +57 -0
  15. package/dist/chunk-DJBU2OEB.js.map +1 -0
  16. package/dist/chunk-LNGWRYGY.js +3 -0
  17. package/dist/chunk-LNGWRYGY.js.map +1 -0
  18. package/dist/chunk-POBNO37G.cjs +4 -0
  19. package/dist/chunk-POBNO37G.cjs.map +1 -0
  20. package/dist/chunk-R64I3LAO.js +701 -0
  21. package/dist/chunk-R64I3LAO.js.map +1 -0
  22. package/dist/chunk-RIRT4JX6.js +1808 -0
  23. package/dist/chunk-RIRT4JX6.js.map +1 -0
  24. package/dist/chunk-WRPVPA7E.cjs +713 -0
  25. package/dist/chunk-WRPVPA7E.cjs.map +1 -0
  26. package/dist/chunk-ZDAHLZWC.cjs +1812 -0
  27. package/dist/chunk-ZDAHLZWC.cjs.map +1 -0
  28. package/dist/chunk-ZSWETUGH.cjs +6623 -0
  29. package/dist/chunk-ZSWETUGH.cjs.map +1 -0
  30. package/dist/constants-Bk2bGYfX.d.ts +64 -0
  31. package/dist/constants-BlOP_9dy.d.cts +64 -0
  32. package/dist/contracts/index.cjs +45 -0
  33. package/dist/contracts/index.cjs.map +1 -0
  34. package/dist/contracts/index.d.cts +6559 -0
  35. package/dist/contracts/index.d.ts +6559 -0
  36. package/dist/contracts/index.js +4 -0
  37. package/dist/contracts/index.js.map +1 -0
  38. package/dist/core/index.cjs +76 -0
  39. package/dist/core/index.cjs.map +1 -0
  40. package/dist/core/index.d.cts +5 -0
  41. package/dist/core/index.d.ts +5 -0
  42. package/dist/core/index.js +7 -0
  43. package/dist/core/index.js.map +1 -0
  44. package/dist/health-BUb4ItNt.d.ts +46 -0
  45. package/dist/health-DPxBqH7b.d.cts +46 -0
  46. package/dist/index-XNClksom.d.ts +415 -0
  47. package/dist/index-yRBqVOHV.d.cts +415 -0
  48. package/dist/index.cjs +138 -0
  49. package/dist/index.cjs.map +1 -0
  50. package/dist/index.d.cts +7 -0
  51. package/dist/index.d.ts +7 -0
  52. package/dist/index.js +9 -0
  53. package/dist/index.js.map +1 -0
  54. package/dist/oracle/index.cjs +30 -0
  55. package/dist/oracle/index.cjs.map +1 -0
  56. package/dist/oracle/index.d.cts +41 -0
  57. package/dist/oracle/index.d.ts +41 -0
  58. package/dist/oracle/index.js +5 -0
  59. package/dist/oracle/index.js.map +1 -0
  60. package/dist/react/index.cjs +383 -0
  61. package/dist/react/index.cjs.map +1 -0
  62. package/dist/react/index.d.cts +339 -0
  63. package/dist/react/index.d.ts +339 -0
  64. package/dist/react/index.js +370 -0
  65. package/dist/react/index.js.map +1 -0
  66. package/dist/types-DySv82My.d.cts +70 -0
  67. package/dist/types-DySv82My.d.ts +70 -0
  68. package/package.json +93 -0
@@ -0,0 +1,64 @@
1
+ import { P as PriceAttestationQuery } from './types-DySv82My.js';
2
+
3
+ /** Configuration for the oracle HTTP client. */
4
+ interface OracleClientConfig {
5
+ /** Oracle service URL. Defaults to DEFAULT_ORACLE_URL. */
6
+ oracleUrl?: string;
7
+ /** Request timeout in milliseconds. Defaults to 5000. */
8
+ timeout?: number;
9
+ /** Custom fetch implementation (for testing or Node.js environments without global fetch). */
10
+ fetch?: typeof globalThis.fetch;
11
+ }
12
+ /** Raw JSON response from the oracle service /v1/ethusd endpoint. */
13
+ interface OracleResponse {
14
+ price: string;
15
+ decimals: number;
16
+ dataTimestamp: string;
17
+ assetPair: `0x${string}`;
18
+ signature: `0x${string}`;
19
+ }
20
+ /** Oracle client interface for fetching signed price attestations. */
21
+ interface OracleClient {
22
+ /** Fetch a signed ETH/USD price attestation ready for mint/burn. */
23
+ getEthUsdAttestation(): Promise<PriceAttestationQuery>;
24
+ /** Get just the ETH/USD price (convenience wrapper). */
25
+ getEthUsdPrice(): Promise<{
26
+ price: bigint;
27
+ timestamp: bigint;
28
+ }>;
29
+ }
30
+
31
+ /**
32
+ * Mock oracle helpers for testing and local development.
33
+ *
34
+ * WARNING: createMockAttestation produces attestations with empty signatures.
35
+ * They only work with MockPriceOracle in tests, NOT with the real PriceOracle
36
+ * on mainnet/testnet (which validates ECDSA signatures).
37
+ */
38
+
39
+ /**
40
+ * Create a mock price attestation for testing/local development.
41
+ *
42
+ * @param price - ETH/USD price in 18 decimals (e.g. 2000n * 10n**18n for $2000)
43
+ * @returns A PriceAttestationQuery suitable for MockPriceOracle
44
+ *
45
+ * @example
46
+ * ```ts
47
+ * const attestation = createMockAttestation(2000n * 10n**18n)
48
+ * await client.mint({
49
+ * to: userAddress,
50
+ * ethAmount: parseEther('1'),
51
+ * priceAttestation: attestation,
52
+ * })
53
+ * ```
54
+ */
55
+ declare function createMockAttestation(price: bigint): PriceAttestationQuery;
56
+
57
+ /** Default oracle service URL. */
58
+ declare const DEFAULT_ORACLE_URL = "https://oracle.upd.io";
59
+ /** The asset pair identifier used by the UPD PriceOracle for ETH/USD. */
60
+ declare const ETH_USD_ASSET_PAIR: `0x${string}`;
61
+ /** Default request timeout in milliseconds. */
62
+ declare const DEFAULT_TIMEOUT = 5000;
63
+
64
+ export { DEFAULT_ORACLE_URL as D, ETH_USD_ASSET_PAIR as E, type OracleClient as O, type OracleClientConfig as a, DEFAULT_TIMEOUT as b, createMockAttestation as c, type OracleResponse as d };
@@ -0,0 +1,64 @@
1
+ import { P as PriceAttestationQuery } from './types-DySv82My.cjs';
2
+
3
+ /** Configuration for the oracle HTTP client. */
4
+ interface OracleClientConfig {
5
+ /** Oracle service URL. Defaults to DEFAULT_ORACLE_URL. */
6
+ oracleUrl?: string;
7
+ /** Request timeout in milliseconds. Defaults to 5000. */
8
+ timeout?: number;
9
+ /** Custom fetch implementation (for testing or Node.js environments without global fetch). */
10
+ fetch?: typeof globalThis.fetch;
11
+ }
12
+ /** Raw JSON response from the oracle service /v1/ethusd endpoint. */
13
+ interface OracleResponse {
14
+ price: string;
15
+ decimals: number;
16
+ dataTimestamp: string;
17
+ assetPair: `0x${string}`;
18
+ signature: `0x${string}`;
19
+ }
20
+ /** Oracle client interface for fetching signed price attestations. */
21
+ interface OracleClient {
22
+ /** Fetch a signed ETH/USD price attestation ready for mint/burn. */
23
+ getEthUsdAttestation(): Promise<PriceAttestationQuery>;
24
+ /** Get just the ETH/USD price (convenience wrapper). */
25
+ getEthUsdPrice(): Promise<{
26
+ price: bigint;
27
+ timestamp: bigint;
28
+ }>;
29
+ }
30
+
31
+ /**
32
+ * Mock oracle helpers for testing and local development.
33
+ *
34
+ * WARNING: createMockAttestation produces attestations with empty signatures.
35
+ * They only work with MockPriceOracle in tests, NOT with the real PriceOracle
36
+ * on mainnet/testnet (which validates ECDSA signatures).
37
+ */
38
+
39
+ /**
40
+ * Create a mock price attestation for testing/local development.
41
+ *
42
+ * @param price - ETH/USD price in 18 decimals (e.g. 2000n * 10n**18n for $2000)
43
+ * @returns A PriceAttestationQuery suitable for MockPriceOracle
44
+ *
45
+ * @example
46
+ * ```ts
47
+ * const attestation = createMockAttestation(2000n * 10n**18n)
48
+ * await client.mint({
49
+ * to: userAddress,
50
+ * ethAmount: parseEther('1'),
51
+ * priceAttestation: attestation,
52
+ * })
53
+ * ```
54
+ */
55
+ declare function createMockAttestation(price: bigint): PriceAttestationQuery;
56
+
57
+ /** Default oracle service URL. */
58
+ declare const DEFAULT_ORACLE_URL = "https://oracle.upd.io";
59
+ /** The asset pair identifier used by the UPD PriceOracle for ETH/USD. */
60
+ declare const ETH_USD_ASSET_PAIR: `0x${string}`;
61
+ /** Default request timeout in milliseconds. */
62
+ declare const DEFAULT_TIMEOUT = 5000;
63
+
64
+ export { DEFAULT_ORACLE_URL as D, ETH_USD_ASSET_PAIR as E, type OracleClient as O, type OracleClientConfig as a, DEFAULT_TIMEOUT as b, createMockAttestation as c, type OracleResponse as d };
@@ -0,0 +1,45 @@
1
+ 'use strict';
2
+
3
+ var chunkZDAHLZWC_cjs = require('../chunk-ZDAHLZWC.cjs');
4
+ var chunkZSWETUGH_cjs = require('../chunk-ZSWETUGH.cjs');
5
+
6
+
7
+
8
+ Object.defineProperty(exports, "BRIDGE_ESCROW_ABI", {
9
+ enumerable: true,
10
+ get: function () { return chunkZDAHLZWC_cjs.BRIDGE_ESCROW_ABI; }
11
+ });
12
+ Object.defineProperty(exports, "INSURANCE_ESCROW_ABI", {
13
+ enumerable: true,
14
+ get: function () { return chunkZDAHLZWC_cjs.INSURANCE_ESCROW_ABI; }
15
+ });
16
+ Object.defineProperty(exports, "PRICE_ORACLE_ABI", {
17
+ enumerable: true,
18
+ get: function () { return chunkZDAHLZWC_cjs.PRICE_ORACLE_ABI; }
19
+ });
20
+ Object.defineProperty(exports, "OVERCOLLATERALIZATION_REPORTER_ABI", {
21
+ enumerable: true,
22
+ get: function () { return chunkZSWETUGH_cjs.OVERCOLLATERALIZATION_REPORTER_ABI; }
23
+ });
24
+ Object.defineProperty(exports, "POSITION_ESCROW_ABI", {
25
+ enumerable: true,
26
+ get: function () { return chunkZSWETUGH_cjs.POSITION_ESCROW_ABI; }
27
+ });
28
+ Object.defineProperty(exports, "STABILIZER_ESCROW_ABI", {
29
+ enumerable: true,
30
+ get: function () { return chunkZSWETUGH_cjs.STABILIZER_ESCROW_ABI; }
31
+ });
32
+ Object.defineProperty(exports, "STABILIZER_NFT_ABI", {
33
+ enumerable: true,
34
+ get: function () { return chunkZSWETUGH_cjs.STABILIZER_NFT_ABI; }
35
+ });
36
+ Object.defineProperty(exports, "SUPD_ABI", {
37
+ enumerable: true,
38
+ get: function () { return chunkZSWETUGH_cjs.SUPD_ABI; }
39
+ });
40
+ Object.defineProperty(exports, "UPD_TOKEN_ABI", {
41
+ enumerable: true,
42
+ get: function () { return chunkZSWETUGH_cjs.UPD_TOKEN_ABI; }
43
+ });
44
+ //# sourceMappingURL=index.cjs.map
45
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs"}