@argent/x-shared 1.69.0 → 1.70.1

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.
@@ -59,7 +59,7 @@ const i = o.extend({
59
59
  }), c = t.object({
60
60
  id: t.string(),
61
61
  investmentId: t.string().optional(),
62
- apy: t.string(),
62
+ apy: t.string().optional(),
63
63
  totalApy: t.string().optional(),
64
64
  token: i,
65
65
  liquidityToken: o.optional()
@@ -2,9 +2,10 @@ import { TransactionExecutionResponse } from '../../../transactions/transactionE
2
2
  import { SwapTransactionParams } from '../models/execute.model';
3
3
  import { PaymasterExecuteParams } from './../../paymaster/types';
4
4
  export interface ISwapTransactionService {
5
- execute({ paymasterParams, transactionParams, isSubsidised, }: {
5
+ execute({ paymasterParams, transactionParams, isSubsidised, currency, }: {
6
6
  paymasterParams?: PaymasterExecuteParams;
7
7
  transactionParams?: SwapTransactionParams[];
8
8
  isSubsidised?: boolean;
9
+ currency: string;
9
10
  }): Promise<TransactionExecutionResponse>;
10
11
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("lodash-es"),v=require("starknet"),A=require("../../../transactions/transactionExecuteTypes.cjs"),_=require("../../../../node_modules/.pnpm/@starknet-io_types-js@0.7.7/node_modules/@starknet-io/types-js/dist/esm/api/nonspec.cjs");class S{constructor(n="",t){this.argentAffiliateUrl=n,this.httpService=t}async execute({paymasterParams:n,transactionParams:t,isSubsidised:g}){if(y.isEmpty(this.argentAffiliateUrl))throw new Error("Argent affiliate URL is not set");let o;n?o={executeRequest:{...n,signature:n.signature,deploymentData:n.deploymentData,userAddress:n.accountAddress,typedData:n.typedData},isSubsidised:g}:o={transactions:t==null?void 0:t.map(e=>{var c,r,u,l,a,d,p,f;const i={type:e.type,calls:e.calls,chainId:e.chainId,cairoVersion:e.cairoVersion,account:e.account,signature:e.signature,nonce:e.nonce,version:e.version};return e.version===_.ETransactionVersion.V1?i.maxFee=e.maxFee:(i.resourceBounds={l1Gas:{maxAmount:(r=(c=e.resourceBounds)==null?void 0:c.l1_gas)==null?void 0:r.max_amount,maxPricePerUnit:(l=(u=e.resourceBounds)==null?void 0:u.l1_gas)==null?void 0:l.max_price_per_unit},l2Gas:{maxAmount:(d=(a=e.resourceBounds)==null?void 0:a.l2_gas)==null?void 0:d.max_amount,maxPricePerUnit:(f=(p=e.resourceBounds)==null?void 0:p.l2_gas)==null?void 0:f.max_price_per_unit}},i.nonceDataAvailabilityMode=e.nonceDataAvailabilityMode,i.feeDataAvailabilityMode=e.feeDataAvailabilityMode,i.tip=e.tip),i})};const h=await this.httpService.post(this.argentAffiliateUrl,{body:v.json.stringify(o),headers:{"Content-Type":"application/json"}}),s=A.transactionExecutionResponseSchema.safeParse(h);if(!s.success)throw new Error("Invalid response from swap API");return s.data}}exports.SwapTransactionService=S;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("lodash-es"),S=require("starknet"),b=require("../../../transactions/transactionExecuteTypes.cjs"),q=require("../../../../node_modules/.pnpm/@starknet-io_types-js@0.7.7/node_modules/@starknet-io/types-js/dist/esm/api/nonspec.cjs"),w=require("../../../utils/url/urlWithQuery.cjs");class D{constructor(n="",t){this.argentAffiliateUrl=n,this.httpService=t}async execute({paymasterParams:n,transactionParams:t,isSubsidised:y,currency:h}){if(_.isEmpty(this.argentAffiliateUrl))throw new Error("Argent affiliate URL is not set");let o;n?o={executeRequest:{...n,signature:n.signature,deploymentData:n.deploymentData,userAddress:n.accountAddress,typedData:n.typedData},isSubsidised:y}:o={transactions:t==null?void 0:t.map(e=>{var r,c,u,l,a,d,p,f;const i={type:e.type,calls:e.calls,chainId:e.chainId,cairoVersion:e.cairoVersion,account:e.account,signature:e.signature,nonce:e.nonce,version:e.version};return e.version===q.ETransactionVersion.V1?i.maxFee=e.maxFee:(i.resourceBounds={l1Gas:{maxAmount:(c=(r=e.resourceBounds)==null?void 0:r.l1_gas)==null?void 0:c.max_amount,maxPricePerUnit:(l=(u=e.resourceBounds)==null?void 0:u.l1_gas)==null?void 0:l.max_price_per_unit},l2Gas:{maxAmount:(d=(a=e.resourceBounds)==null?void 0:a.l2_gas)==null?void 0:d.max_amount,maxPricePerUnit:(f=(p=e.resourceBounds)==null?void 0:p.l2_gas)==null?void 0:f.max_price_per_unit}},i.nonceDataAvailabilityMode=e.nonceDataAvailabilityMode,i.feeDataAvailabilityMode=e.feeDataAvailabilityMode,i.tip=e.tip),i})};const g={currency:h},v=w.urlWithQuery(this.argentAffiliateUrl,g),A=await this.httpService.post(v,{body:S.json.stringify(o),headers:{"Content-Type":"application/json"}}),s=b.transactionExecutionResponseSchema.safeParse(A);if(!s.success)throw new Error("Invalid response from swap API");return s.data}}exports.SwapTransactionService=D;
@@ -7,9 +7,10 @@ export declare class SwapTransactionService implements ISwapTransactionService {
7
7
  private readonly argentAffiliateUrl;
8
8
  private readonly httpService;
9
9
  constructor(argentAffiliateUrl: string | undefined, httpService: IHttpService);
10
- execute({ paymasterParams, transactionParams, isSubsidised, }: {
10
+ execute({ paymasterParams, transactionParams, isSubsidised, currency, }: {
11
11
  paymasterParams?: PaymasterExecuteParams;
12
12
  transactionParams?: SwapTransactionParams[];
13
13
  isSubsidised?: boolean;
14
+ currency: string;
14
15
  }): Promise<TransactionExecutionResponse>;
15
16
  }
@@ -1,28 +1,29 @@
1
- import { isEmpty as A } from "lodash-es";
2
- import { json as _ } from "starknet";
3
- import { transactionExecutionResponseSchema as v } from "../../../transactions/transactionExecuteTypes.js";
4
- import { ETransactionVersion as y } from "../../../../node_modules/.pnpm/@starknet-io_types-js@0.7.7/node_modules/@starknet-io/types-js/dist/esm/api/nonspec.js";
5
- class R {
6
- constructor(i = "", n) {
7
- this.argentAffiliateUrl = i, this.httpService = n;
1
+ import { isEmpty as v } from "lodash-es";
2
+ import { json as D } from "starknet";
3
+ import { transactionExecutionResponseSchema as w } from "../../../transactions/transactionExecuteTypes.js";
4
+ import { ETransactionVersion as b } from "../../../../node_modules/.pnpm/@starknet-io_types-js@0.7.7/node_modules/@starknet-io/types-js/dist/esm/api/nonspec.js";
5
+ import { urlWithQuery as U } from "../../../utils/url/urlWithQuery.js";
6
+ class q {
7
+ constructor(o = "", n) {
8
+ this.argentAffiliateUrl = o, this.httpService = n;
8
9
  }
9
- async execute({ paymasterParams: i, transactionParams: n, isSubsidised: g }) {
10
- if (A(this.argentAffiliateUrl))
10
+ async execute({ paymasterParams: o, transactionParams: n, isSubsidised: h, currency: g }) {
11
+ if (v(this.argentAffiliateUrl))
11
12
  throw new Error("Argent affiliate URL is not set");
12
13
  let t;
13
- i ? t = {
14
+ o ? t = {
14
15
  executeRequest: {
15
- ...i,
16
- signature: i.signature,
17
- deploymentData: i.deploymentData,
18
- userAddress: i.accountAddress,
19
- typedData: i.typedData
16
+ ...o,
17
+ signature: o.signature,
18
+ deploymentData: o.deploymentData,
19
+ userAddress: o.accountAddress,
20
+ typedData: o.typedData
20
21
  },
21
- isSubsidised: g
22
+ isSubsidised: h
22
23
  } : t = {
23
24
  transactions: n == null ? void 0 : n.map((e) => {
24
- var c, r, l, u, p, d, a, f;
25
- const o = {
25
+ var s, c, u, l, p, a, d, f;
26
+ const i = {
26
27
  type: e.type,
27
28
  calls: e.calls,
28
29
  chainId: e.chainId,
@@ -32,29 +33,31 @@ class R {
32
33
  nonce: e.nonce,
33
34
  version: e.version
34
35
  };
35
- return e.version === y.V1 ? o.maxFee = e.maxFee : (o.resourceBounds = {
36
+ return e.version === b.V1 ? i.maxFee = e.maxFee : (i.resourceBounds = {
36
37
  l1Gas: {
37
- maxAmount: (r = (c = e.resourceBounds) == null ? void 0 : c.l1_gas) == null ? void 0 : r.max_amount,
38
- maxPricePerUnit: (u = (l = e.resourceBounds) == null ? void 0 : l.l1_gas) == null ? void 0 : u.max_price_per_unit
38
+ maxAmount: (c = (s = e.resourceBounds) == null ? void 0 : s.l1_gas) == null ? void 0 : c.max_amount,
39
+ maxPricePerUnit: (l = (u = e.resourceBounds) == null ? void 0 : u.l1_gas) == null ? void 0 : l.max_price_per_unit
39
40
  },
40
41
  l2Gas: {
41
- maxAmount: (d = (p = e.resourceBounds) == null ? void 0 : p.l2_gas) == null ? void 0 : d.max_amount,
42
- maxPricePerUnit: (f = (a = e.resourceBounds) == null ? void 0 : a.l2_gas) == null ? void 0 : f.max_price_per_unit
42
+ maxAmount: (a = (p = e.resourceBounds) == null ? void 0 : p.l2_gas) == null ? void 0 : a.max_amount,
43
+ maxPricePerUnit: (f = (d = e.resourceBounds) == null ? void 0 : d.l2_gas) == null ? void 0 : f.max_price_per_unit
43
44
  }
44
- }, o.nonceDataAvailabilityMode = e.nonceDataAvailabilityMode, o.feeDataAvailabilityMode = e.feeDataAvailabilityMode, o.tip = e.tip), o;
45
+ }, i.nonceDataAvailabilityMode = e.nonceDataAvailabilityMode, i.feeDataAvailabilityMode = e.feeDataAvailabilityMode, i.tip = e.tip), i;
45
46
  })
46
47
  };
47
- const h = await this.httpService.post(this.argentAffiliateUrl, {
48
- body: _.stringify(t),
48
+ const y = {
49
+ currency: g
50
+ }, A = U(this.argentAffiliateUrl, y), _ = await this.httpService.post(A, {
51
+ body: D.stringify(t),
49
52
  headers: {
50
53
  "Content-Type": "application/json"
51
54
  }
52
- }), s = v.safeParse(h);
53
- if (!s.success)
55
+ }), r = w.safeParse(_);
56
+ if (!r.success)
54
57
  throw new Error("Invalid response from swap API");
55
- return s.data;
58
+ return r.data;
56
59
  }
57
60
  }
58
61
  export {
59
- R as SwapTransactionService
62
+ q as SwapTransactionService
60
63
  };
@@ -279,21 +279,21 @@ export declare class TokenServiceWeb implements ITokenServiceWeb {
279
279
  totalBalances: import('zod').ZodRecord<import('zod').ZodString, import('zod').ZodString>;
280
280
  }, {
281
281
  data: import('zod').ZodObject<{
282
- apy: import('zod').ZodString;
283
- totalApy: import('zod').ZodString;
282
+ apy: import('zod').ZodOptional<import('zod').ZodString>;
283
+ totalApy: import('zod').ZodOptional<import('zod').ZodString>;
284
284
  }, "strip", import('zod').ZodTypeAny, {
285
- totalApy: string;
286
- apy: string;
285
+ totalApy?: string | undefined;
286
+ apy?: string | undefined;
287
287
  }, {
288
- totalApy: string;
289
- apy: string;
288
+ totalApy?: string | undefined;
289
+ apy?: string | undefined;
290
290
  }>;
291
291
  investmentId: import('zod').ZodOptional<import('zod').ZodString>;
292
292
  totalBalances: import('zod').ZodRecord<import('zod').ZodString, import('zod').ZodString>;
293
293
  }>, "strip", import('zod').ZodTypeAny, {
294
294
  data: {
295
- totalApy: string;
296
- apy: string;
295
+ totalApy?: string | undefined;
296
+ apy?: string | undefined;
297
297
  };
298
298
  id: string;
299
299
  totalBalances: Record<string, string>;
@@ -301,8 +301,8 @@ export declare class TokenServiceWeb implements ITokenServiceWeb {
301
301
  investmentId?: string | undefined;
302
302
  }, {
303
303
  data: {
304
- totalApy: string;
305
- apy: string;
304
+ totalApy?: string | undefined;
305
+ apy?: string | undefined;
306
306
  };
307
307
  id: string;
308
308
  totalBalances: Record<string, string>;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("zod"),a=require("../../../chains/starknet/address.cjs"),h=require("./defiPositionType.model.cjs"),b=require("../../../utils/schemas.cjs"),u=e.z.object({status:e.z.literal("initialising")}).or(e.z.object({status:e.z.literal("initialised"),balances:e.z.array(e.z.object({tokenAddress:a.addressSchemaArgentBackend,tokenBalance:e.z.string()}))})),o=e.z.object({id:e.z.number(),address:a.addressSchema,brandColor:e.z.string().optional(),name:e.z.string(),symbol:e.z.string(),decimals:e.z.number(),iconUrl:e.z.string().optional(),sendable:e.z.boolean(),popular:e.z.boolean(),refundable:e.z.boolean(),listed:e.z.boolean(),tradable:e.z.boolean(),category:e.z.union([e.z.literal("tokens"),e.z.literal("currencies"),e.z.literal("savings")]),pricingId:e.z.number().optional(),dappId:e.z.string().optional(),marketData:e.z.object({marketCap:e.z.number().default(0),marketCap24hChange:e.z.number().default(0),dailyVolume:e.z.number().default(0),rank:e.z.number().default(0)}).optional(),tags:e.z.array(e.z.string()).optional()}),k=e.z.object({tokens:e.z.array(o)}),D=o,d=e.z.object({pricingId:e.z.number(),ethValue:e.z.string(),ccyValue:e.z.string(),ethDayChange:e.z.string(),ccyDayChange:e.z.string()}),y=e.z.object({prices:e.z.array(d)}),i=e.z.object({tokenAddress:a.addressSchemaArgentBackend,principal:e.z.string(),accruedFees:e.z.string(),minPrice:e.z.string(),maxPrice:e.z.string(),currentPrice:e.z.string()}),t=e.z.object({id:e.z.string(),investmentId:e.z.string().optional(),tokenAddress:a.addressSchema.optional(),totalBalances:e.z.record(e.z.string())}),n=t.extend({tokenId:e.z.string(),data:e.z.object({poolFeePercentage:e.z.string(),tickSpacingPercentage:e.z.string().optional(),token0:i,token1:i})}),P=e.z.array(n),s=t.extend({data:e.z.object({apy:e.z.string(),totalApy:e.z.string()}),investmentId:e.z.string().optional(),totalBalances:e.z.record(e.z.string())}),f=e.z.array(s),r=t.extend({data:e.z.object({apy:e.z.string().optional(),totalApy:e.z.string().optional(),group:e.z.number().optional(),collateral:e.z.boolean(),debt:e.z.boolean(),lending:e.z.boolean()})}),j=e.z.array(r),c=t.extend({id:e.z.string(),data:e.z.object({delegatingTo:a.addressSchema}),totalBalances:e.z.record(e.z.string())}),A=e.z.array(c),p=t.extend({investmentId:e.z.string().optional(),data:e.z.object({stakerInfo:e.z.object({name:e.z.string().optional(),iconUrl:e.z.string().optional(),address:a.addressSchema}),accruedRewards:e.z.string(),stakedAmount:e.z.string(),pendingWithdrawal:e.z.object({amount:e.z.string(),withdrawableAfter:e.z.number()}).optional(),apy:e.z.string().optional(),totalApy:e.z.string().optional()})}),T=e.z.array(p),l=n.or(r).or(c).or(s).or(p),z=e.z.array(l),m=b.createSchemaWithWarnings({productId:e.z.string().optional(),name:e.z.string(),manageUrl:e.z.string().optional(),type:h.defiPositionTypeSchema,groups:e.z.record(e.z.object({name:e.z.string().optional(),healthRatio:e.z.string().optional()})).optional(),positions:z}),g=e.z.object({dappId:e.z.string(),products:e.z.array(m)}),I=e.z.object({dapps:e.z.array(g)}),S=e.z.object({name:e.z.string().optional(),tokenAddress:a.addressSchema,amount:e.z.string().optional(),claimUrl:e.z.string().optional(),claimStart:e.z.number(),claimEnd:e.z.number().optional()}),C=e.z.object({accountAddress:a.addressSchema,chain:e.z.string(),airdrops:e.z.array(S)});exports.apiAccountTokenBalancesSchema=u;exports.apiAirdropSchema=S;exports.apiCollateralizedDebtPositionSchema=r;exports.apiCollateralizedDebtPositionsSchema=j;exports.apiConcentratedLiquidityPositionSchema=n;exports.apiConcentratedLiquidityPositionsSchema=P;exports.apiDefiDecompositionProduct=m;exports.apiDefiDecompositionProducts=z;exports.apiDefiDecompositionSchema=g;exports.apiDefiDecompositionToken=i;exports.apiDefiPositionSchema=l;exports.apiDefiPositionsSchema=I;exports.apiDelegatedTokensArraySchema=A;exports.apiDelegatedTokensSchema=c;exports.apiPriceDataResponseSchema=y;exports.apiPriceDetailsSchema=d;exports.apiStakingPositionSchema=s;exports.apiStakingPositionsSchema=f;exports.apiStrkDelegatedStakingPositionsSchema=T;exports.apiStrkDelegatedStakingSchema=p;exports.apiTokenInfoResponseSchema=D;exports.apiTokenInfoSchema=o;exports.apiTokensInfoResponseSchema=k;exports.apiUnclaimedRewardsSchema=C;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("zod"),a=require("../../../chains/starknet/address.cjs"),h=require("./defiPositionType.model.cjs"),b=require("../../../utils/schemas.cjs"),u=e.z.object({status:e.z.literal("initialising")}).or(e.z.object({status:e.z.literal("initialised"),balances:e.z.array(e.z.object({tokenAddress:a.addressSchemaArgentBackend,tokenBalance:e.z.string()}))})),o=e.z.object({id:e.z.number(),address:a.addressSchema,brandColor:e.z.string().optional(),name:e.z.string(),symbol:e.z.string(),decimals:e.z.number(),iconUrl:e.z.string().optional(),sendable:e.z.boolean(),popular:e.z.boolean(),refundable:e.z.boolean(),listed:e.z.boolean(),tradable:e.z.boolean(),category:e.z.union([e.z.literal("tokens"),e.z.literal("currencies"),e.z.literal("savings")]),pricingId:e.z.number().optional(),dappId:e.z.string().optional(),marketData:e.z.object({marketCap:e.z.number().default(0),marketCap24hChange:e.z.number().default(0),dailyVolume:e.z.number().default(0),rank:e.z.number().default(0)}).optional(),tags:e.z.array(e.z.string()).optional()}),k=e.z.object({tokens:e.z.array(o)}),D=o,d=e.z.object({pricingId:e.z.number(),ethValue:e.z.string(),ccyValue:e.z.string(),ethDayChange:e.z.string(),ccyDayChange:e.z.string()}),y=e.z.object({prices:e.z.array(d)}),i=e.z.object({tokenAddress:a.addressSchemaArgentBackend,principal:e.z.string(),accruedFees:e.z.string(),minPrice:e.z.string(),maxPrice:e.z.string(),currentPrice:e.z.string()}),t=e.z.object({id:e.z.string(),investmentId:e.z.string().optional(),tokenAddress:a.addressSchema.optional(),totalBalances:e.z.record(e.z.string())}),n=t.extend({tokenId:e.z.string(),data:e.z.object({poolFeePercentage:e.z.string(),tickSpacingPercentage:e.z.string().optional(),token0:i,token1:i})}),P=e.z.array(n),s=t.extend({data:e.z.object({apy:e.z.string().optional(),totalApy:e.z.string().optional()}),investmentId:e.z.string().optional(),totalBalances:e.z.record(e.z.string())}),f=e.z.array(s),r=t.extend({data:e.z.object({apy:e.z.string().optional(),totalApy:e.z.string().optional(),group:e.z.number().optional(),collateral:e.z.boolean(),debt:e.z.boolean(),lending:e.z.boolean()})}),j=e.z.array(r),c=t.extend({id:e.z.string(),data:e.z.object({delegatingTo:a.addressSchema}),totalBalances:e.z.record(e.z.string())}),A=e.z.array(c),p=t.extend({investmentId:e.z.string().optional(),data:e.z.object({stakerInfo:e.z.object({name:e.z.string().optional(),iconUrl:e.z.string().optional(),address:a.addressSchema}),accruedRewards:e.z.string(),stakedAmount:e.z.string(),pendingWithdrawal:e.z.object({amount:e.z.string(),withdrawableAfter:e.z.number()}).optional(),apy:e.z.string().optional(),totalApy:e.z.string().optional()})}),T=e.z.array(p),l=n.or(r).or(c).or(s).or(p),z=e.z.array(l),m=b.createSchemaWithWarnings({productId:e.z.string().optional(),name:e.z.string(),manageUrl:e.z.string().optional(),type:h.defiPositionTypeSchema,groups:e.z.record(e.z.object({name:e.z.string().optional(),healthRatio:e.z.string().optional()})).optional(),positions:z}),g=e.z.object({dappId:e.z.string(),products:e.z.array(m)}),I=e.z.object({dapps:e.z.array(g)}),S=e.z.object({name:e.z.string().optional(),tokenAddress:a.addressSchema,amount:e.z.string().optional(),claimUrl:e.z.string().optional(),claimStart:e.z.number(),claimEnd:e.z.number().optional()}),C=e.z.object({accountAddress:a.addressSchema,chain:e.z.string(),airdrops:e.z.array(S)});exports.apiAccountTokenBalancesSchema=u;exports.apiAirdropSchema=S;exports.apiCollateralizedDebtPositionSchema=r;exports.apiCollateralizedDebtPositionsSchema=j;exports.apiConcentratedLiquidityPositionSchema=n;exports.apiConcentratedLiquidityPositionsSchema=P;exports.apiDefiDecompositionProduct=m;exports.apiDefiDecompositionProducts=z;exports.apiDefiDecompositionSchema=g;exports.apiDefiDecompositionToken=i;exports.apiDefiPositionSchema=l;exports.apiDefiPositionsSchema=I;exports.apiDelegatedTokensArraySchema=A;exports.apiDelegatedTokensSchema=c;exports.apiPriceDataResponseSchema=y;exports.apiPriceDetailsSchema=d;exports.apiStakingPositionSchema=s;exports.apiStakingPositionsSchema=f;exports.apiStrkDelegatedStakingPositionsSchema=T;exports.apiStrkDelegatedStakingSchema=p;exports.apiTokenInfoResponseSchema=D;exports.apiTokenInfoSchema=o;exports.apiTokensInfoResponseSchema=k;exports.apiUnclaimedRewardsSchema=C;