@rozoai/intent-common 0.1.27-beta.2 → 0.1.27

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/api/fee.d.ts CHANGED
@@ -1,35 +1,21 @@
1
+ /**
2
+ * @deprecated Use `getFee` from `@rozoai/intent-common` with `CreateNewPaymentParams`
3
+ * instead. This file exists only for backward compatibility during the transition
4
+ * from `GetFeeParams` to `CreateNewPaymentParams`. It will be removed in a future
5
+ * release.
6
+ *
7
+ * `GetFeeParams` is preserved here so consumers pinning an older version of this
8
+ * package can upgrade without a breaking build failure. New code should import
9
+ * `getFee` and `CreateNewPaymentParams` from the root of this package.
10
+ */
1
11
  import { ApiResponse } from "./base";
2
12
  import { FeeType } from "./types";
3
- export interface FeeResponseData {
4
- status: string;
5
- type: string;
6
- source: {
7
- chainId: string;
8
- tokenSymbol: string;
9
- amount: string;
10
- fee: string;
11
- };
12
- destination: {
13
- chainId: string;
14
- tokenSymbol: string;
15
- amount: string;
16
- };
17
- feeInfo: {
18
- feePercentage: string;
19
- minimumFee: string;
20
- };
21
- }
22
- export interface FeeErrorData {
23
- error: {
24
- code: string;
25
- message: string;
26
- };
27
- requestId?: string;
28
- data?: {
29
- errorCode: string;
30
- maxAmount?: number;
31
- };
32
- }
13
+ import type { FeeResponseData } from "./payment";
14
+ /**
15
+ * @deprecated Use `CreateNewPaymentParams` instead. This interface is a legacy
16
+ * shape that predates the unified payment payload. It will be removed in a
17
+ * future release.
18
+ */
33
19
  export interface GetFeeParams {
34
20
  appId?: string;
35
21
  type: FeeType;
@@ -40,4 +26,11 @@ export interface GetFeeParams {
40
26
  destReceiverAddress: string;
41
27
  destTokenSymbol: string;
42
28
  }
43
- export declare const getFee: (params: GetFeeParams) => Promise<ApiResponse<FeeResponseData>>;
29
+ /**
30
+ * @deprecated Use `getFee` (the default export from `@rozoai/intent-common`)
31
+ * which accepts `CreateNewPaymentParams`. This wrapper preserves the old
32
+ * request body shape (token symbols, separate source/destination amounts)
33
+ * and posts directly to the dry-run endpoint, so existing consumers can
34
+ * upgrade without a breaking change. It will be removed in a future release.
35
+ */
36
+ export declare const getFeeLegacy: (params: GetFeeParams) => Promise<ApiResponse<FeeResponseData>>;
package/dist/api/fee.js CHANGED
@@ -1,10 +1,27 @@
1
1
  "use strict";
2
+ /**
3
+ * @deprecated Use `getFee` from `@rozoai/intent-common` with `CreateNewPaymentParams`
4
+ * instead. This file exists only for backward compatibility during the transition
5
+ * from `GetFeeParams` to `CreateNewPaymentParams`. It will be removed in a future
6
+ * release.
7
+ *
8
+ * `GetFeeParams` is preserved here so consumers pinning an older version of this
9
+ * package can upgrade without a breaking build failure. New code should import
10
+ * `getFee` and `CreateNewPaymentParams` from the root of this package.
11
+ */
2
12
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getFee = void 0;
13
+ exports.getFeeLegacy = void 0;
4
14
  const chain_1 = require("../chain");
5
15
  const base_1 = require("./base");
6
16
  const types_1 = require("./types");
7
- const getFee = async (params) => {
17
+ /**
18
+ * @deprecated Use `getFee` (the default export from `@rozoai/intent-common`)
19
+ * which accepts `CreateNewPaymentParams`. This wrapper preserves the old
20
+ * request body shape (token symbols, separate source/destination amounts)
21
+ * and posts directly to the dry-run endpoint, so existing consumers can
22
+ * upgrade without a breaking change. It will be removed in a future release.
23
+ */
24
+ const getFeeLegacy = async (params) => {
8
25
  const { appId, type, sourceChainId, sourceTokenSymbol, amount, destChainId, destReceiverAddress, destTokenSymbol, } = params;
9
26
  const isExactOut = type === types_1.FeeType.ExactOut;
10
27
  const body = {
@@ -13,9 +30,7 @@ const getFee = async (params) => {
13
30
  source: {
14
31
  chainId: Number(sourceChainId) === chain_1.solana.chainId
15
32
  ? String(chain_1.rozoSolana.chainId)
16
- : Number(sourceChainId) === chain_1.stellar.chainId
17
- ? String(chain_1.rozoStellar.chainId)
18
- : sourceChainId,
33
+ : sourceChainId,
19
34
  tokenSymbol: sourceTokenSymbol,
20
35
  ...(type === types_1.FeeType.ExactIn || type === types_1.FeeType.AnyAmount ? { amount } : {}),
21
36
  },
@@ -40,5 +55,5 @@ const getFee = async (params) => {
40
55
  }
41
56
  return { data: result.data, error: null, status: result.status };
42
57
  };
43
- exports.getFee = getFee;
58
+ exports.getFeeLegacy = getFeeLegacy;
44
59
  //# sourceMappingURL=fee.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fee.js","sourceRoot":"","sources":["../../src/api/fee.ts"],"names":[],"mappings":";;;AAAA,oCAAoE;AACpE,iCAAgD;AAChD,mCAAkC;AA6C3B,MAAM,MAAM,GAAG,KAAK,EAAE,MAAoB,EAAyC,EAAE;IAC1F,MAAM,EACJ,KAAK,EACL,IAAI,EACJ,aAAa,EACb,iBAAiB,EACjB,MAAM,EACN,WAAW,EACX,mBAAmB,EACnB,eAAe,GAChB,GAAG,MAAM,CAAC;IAEX,MAAM,UAAU,GAAG,IAAI,KAAK,eAAO,CAAC,QAAQ,CAAC;IAC7C,MAAM,IAAI,GAAG;QACX,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3B,IAAI;QACJ,MAAM,EAAE;YACN,OAAO,EACL,MAAM,CAAC,aAAa,CAAC,KAAK,cAAM,CAAC,OAAO;gBACtC,CAAC,CAAC,MAAM,CAAC,kBAAU,CAAC,OAAO,CAAC;gBAC5B,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,eAAO,CAAC,OAAO;oBACzC,CAAC,CAAC,MAAM,CAAC,mBAAW,CAAC,OAAO,CAAC;oBAC7B,CAAC,CAAC,aAAa;YACrB,WAAW,EAAE,iBAAiB;YAC9B,GAAG,CAAC,IAAI,KAAK,eAAO,CAAC,OAAO,IAAI,IAAI,KAAK,eAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC9E;QACD,WAAW,EAAE;YACX,OAAO,EAAE,WA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,GAAG,MAAM,CAAC,IAAoD,CAAC;QAC5E,OAAO;YACL,IAAI,EAAE,IAAI;YACV,KAAK,EAAE,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,IAAI,wBAAwB,CAAC;YACpE,MAAM,EAAE,MAAM,CAAC,MAAM;SACtB,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,IAAuB,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;AACtF,CAAC,CAAC;AApDW,QAAA,YAAY,gBAoDvB"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { setApiConfig, type ApiVersion } from "./api/base";
2
+ export * from "./api/fee";
2
3
  export * from "./api/payment";
3
4
  export * from "./api/types";
4
5
  export * from "./assert";
package/dist/index.js CHANGED
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.setApiConfig = void 0;
18
18
  var base_1 = require("./api/base");
19
19
  Object.defineProperty(exports, "setApiConfig", { enumerable: true, get: function () { return base_1.setApiConfig; } });
20
+ __exportStar(require("./api/fee"), exports);
20
21
  __exportStar(require("./api/payment"), exports);
21
22
  __exportStar(require("./api/types"), exports);
22
23
  __exportStar(require("./assert"), exports);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,mCAA2D;AAAlD,oGAAA,YAAY,OAAA;AACrB,gDAA8B;AAC9B,8CAA4B;AAC5B,2CAAyB;AACzB,iDAA+B;AAC/B,0CAAwB;AACxB,0CAAwB;AACxB,2CAAyB;AACzB,mDAAiC;AACjC,iDAA+B;AAC/B,4CAA0B;AAC1B,0CAAwB;AACxB,wCAAsB;AACtB,+CAA6B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,mCAA2D;AAAlD,oGAAA,YAAY,OAAA;AACrB,4CAA0B;AAC1B,gDAA8B;AAC9B,8CAA4B;AAC5B,2CAAyB;AACzB,iDAA+B;AAC/B,0CAAwB;AACxB,0CAAwB;AACxB,2CAAyB;AACzB,mDAAiC;AACjC,iDAA+B;AAC/B,4CAA0B;AAC1B,0CAAwB;AACxB,wCAAsB;AACtB,+CAA6B"}
package/dist/rozoPay.d.ts CHANGED
@@ -44,11 +44,11 @@ export declare const zBridgeTokenOutOptions: z.ZodArray<z.ZodObject<{
44
44
  token: z.ZodEffects<z.ZodString, `0x${string}`, string>;
45
45
  amount: z.ZodEffects<z.ZodEffects<z.ZodString, `${bigint}`, string>, bigint, string>;
46
46
  }, "strip", z.ZodTypeAny, {
47
- token: `0x${string}`;
48
47
  amount: bigint;
48
+ token: `0x${string}`;
49
49
  }, {
50
- token: string;
51
50
  amount: string;
51
+ token: string;
52
52
  }>, "many">;
53
53
  export type BridgeTokenOutOptions = z.infer<typeof zBridgeTokenOutOptions>;
54
54
  export declare const zRozoPayOrderMetadata: z.ZodObject<{
@@ -68,14 +68,14 @@ export declare const zRozoPayOrderMetadata: z.ZodObject<{
68
68
  price: z.ZodOptional<z.ZodString>;
69
69
  priceDetails: z.ZodOptional<z.ZodString>;
70
70
  }, "strip", z.ZodTypeAny, {
71
- name: string;
72
71
  description: string;
72
+ name: string;
73
73
  image?: string | undefined;
74
74
  price?: string | undefined;
75
75
  priceDetails?: string | undefined;
76
76
  }, {
77
- name: string;
78
77
  description: string;
78
+ name: string;
79
79
  image?: string | undefined;
80
80
  price?: string | undefined;
81
81
  priceDetails?: string | undefined;
@@ -119,12 +119,13 @@ export declare const zRozoPayOrderMetadata: z.ZodObject<{
119
119
  }, "strip", z.ZodTypeAny, {
120
120
  intent: string;
121
121
  items: {
122
- name: string;
123
122
  description: string;
123
+ name: string;
124
124
  image?: string | undefined;
125
125
  price?: string | undefined;
126
126
  priceDetails?: string | undefined;
127
127
  }[];
128
+ sourceTokenSymbol?: string | null | undefined;
128
129
  memo?: string | undefined;
129
130
  style?: {
130
131
  background?: string | undefined;
@@ -142,16 +143,16 @@ export declare const zRozoPayOrderMetadata: z.ZodObject<{
142
143
  customDeeplinkUrl?: string | undefined;
143
144
  dataSuffix?: string | undefined;
144
145
  sourceAmountUnits?: string | null | undefined;
145
- sourceTokenSymbol?: string | null | undefined;
146
146
  }, {
147
147
  intent: string;
148
148
  items: {
149
- name: string;
150
149
  description: string;
150
+ name: string;
151
151
  image?: string | undefined;
152
152
  price?: string | undefined;
153
153
  priceDetails?: string | undefined;
154
154
  }[];
155
+ sourceTokenSymbol?: string | null | undefined;
155
156
  memo?: string | undefined;
156
157
  style?: {
157
158
  background?: string | undefined;
@@ -169,7 +170,6 @@ export declare const zRozoPayOrderMetadata: z.ZodObject<{
169
170
  customDeeplinkUrl?: string | undefined;
170
171
  dataSuffix?: string | undefined;
171
172
  sourceAmountUnits?: string | null | undefined;
172
- sourceTokenSymbol?: string | null | undefined;
173
173
  }>;
174
174
  export type RozoPayOrderMetadata = z.infer<typeof zRozoPayOrderMetadata>;
175
175
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rozoai/intent-common",
3
- "version": "0.1.27-beta.2",
3
+ "version": "0.1.27",
4
4
  "description": "Intent Pay shared types and utilities",
5
5
  "homepage": "https://github.com/RozoAI/intent-pay",
6
6
  "license": "BSD-2-Clause",
@@ -31,9 +31,11 @@
31
31
  "@scure/base": "^1.2.4",
32
32
  "@solana/web3.js": "^1.98.4",
33
33
  "@stellar/stellar-sdk": "^14.4.3",
34
- "viem": "^2.23.2",
35
34
  "zod": "^3.25.76"
36
35
  },
36
+ "peerDependencies": {
37
+ "viem": "^2.23.2"
38
+ },
37
39
  "devDependencies": {
38
40
  "@tsconfig/node20": "^20.1.4",
39
41
  "@types/tape": "^5.6.0",
@@ -42,6 +44,7 @@
42
44
  "oxlint": "latest",
43
45
  "tape": "^5.6.3",
44
46
  "ts-node": "^10.9.2",
45
- "typescript": "5.5.2"
47
+ "typescript": "5.5.2",
48
+ "viem": "^2.23.2"
46
49
  }
47
50
  }