@argent/x-shared 1.62.0 → 1.62.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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("url-join"),s=require("zod"),o=require("../../errors/address.cjs"),m=require("./argentName.cjs"),d=require("./address.cjs"),w=require("../../http/HttpError.cjs"),E=s.z.object({walletAddress:d.addressSchemaArgentBackend,ens:m.argentNameSchema,chain:s.z.enum(["ethereum","starknet"]),deleted:s.z.boolean(),walletDeployed:s.z.boolean()}).or(s.z.object({status:s.z.string()}));async function N(t,n,a,c="starknet"){const i={ens:t,chain:c},l=new URLSearchParams(i),A=u(a,"wallet",`?${l}`);try{const e=await n.get(A),r=e&&"walletAddress"in e?e.walletAddress:void 0;if(!r)throw new o.AddressError({code:"NO_ADDRESS_FROM_ARGENT_NAME"});if(d.isZeroAddress(r))throw new o.AddressError({code:"ARGENT_NAME_NOT_FOUND",message:`${t} not found`});if(!d.isValidAddress(r))throw new o.AddressError({code:"ARGENT_NAME_INVALID_ADDRESS",message:`${t} resolved to an invalid address (${r})`});return d.normalizeAddress(r)}catch(e){throw e instanceof w.HttpError&&e.status===404?new o.AddressError({code:"ARGENT_NAME_NOT_FOUND",message:`${t} not found`}):e}}exports.apiWalletResponseSchema=E;exports.getAddressFromArgentName=N;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("url-join"),s=require("zod"),d=require("./address.cjs"),m=require("./argentName.cjs"),o=require("../../errors/address.cjs"),w=require("../../http/HttpError.cjs"),E=s.z.object({walletAddress:d.addressSchemaArgentBackend,ens:m.argentNameSchema,chain:s.z.enum(["ethereum","starknet"]),deleted:s.z.boolean(),walletDeployed:s.z.boolean()}).or(s.z.object({status:s.z.string()}));async function N(t,n,a,c="starknet"){const i={ens:t,chain:c},l=new URLSearchParams(i),A=u(a,"wallet",`?${l}`);try{const e=await n.get(A),r=e&&"walletAddress"in e?e.walletAddress:void 0;if(!r)throw new o.AddressError({code:"NO_ADDRESS_FROM_ARGENT_NAME"});if(d.isZeroAddress(r))throw new o.AddressError({code:"ARGENT_NAME_NOT_FOUND",message:`${t} not found`});if(!d.isValidAddress(r))throw new o.AddressError({code:"ARGENT_NAME_INVALID_ADDRESS",message:`${t} resolved to an invalid address (${r})`});return d.normalizeAddress(r)}catch(e){throw e instanceof w.HttpError&&e.status===404?new o.AddressError({code:"ARGENT_NAME_NOT_FOUND",message:`${t} not found`}):e}}exports.apiWalletResponseSchema=E;exports.getAddressFromArgentName=N;
@@ -1,12 +1,12 @@
1
1
  import m from "url-join";
2
2
  import { z as s } from "zod";
3
+ import { addressSchemaArgentBackend as A, isZeroAddress as w, isValidAddress as f, normalizeAddress as N } from "./address.js";
4
+ import { argentNameSchema as h } from "./argentName.js";
3
5
  import { AddressError as t } from "../../errors/address.js";
4
- import { argentNameSchema as A } from "./argentName.js";
5
- import { addressSchemaArgentBackend as w, isZeroAddress as f, isValidAddress as N, normalizeAddress as h } from "./address.js";
6
6
  import { HttpError as _ } from "../../http/HttpError.js";
7
7
  const O = s.object({
8
- walletAddress: w,
9
- ens: A,
8
+ walletAddress: A,
9
+ ens: h,
10
10
  chain: s.enum(["ethereum", "starknet"]),
11
11
  deleted: s.boolean(),
12
12
  walletDeployed: s.boolean()
@@ -24,17 +24,17 @@ async function T(o, n, a, d = "starknet") {
24
24
  throw new t({
25
25
  code: "NO_ADDRESS_FROM_ARGENT_NAME"
26
26
  });
27
- if (f(r))
27
+ if (w(r))
28
28
  throw new t({
29
29
  code: "ARGENT_NAME_NOT_FOUND",
30
30
  message: `${o} not found`
31
31
  });
32
- if (!N(r))
32
+ if (!f(r))
33
33
  throw new t({
34
34
  code: "ARGENT_NAME_INVALID_ADDRESS",
35
35
  message: `${o} resolved to an invalid address (${r})`
36
36
  });
37
- return h(r);
37
+ return N(r);
38
38
  } catch (e) {
39
39
  throw e instanceof _ && e.status === 404 ? new t({
40
40
  code: "ARGENT_NAME_NOT_FOUND",
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../../../../errors/address.cjs"),d=require("../../address.cjs"),a=require("../../starknetId.cjs"),o=require("../../getAddressFromStarkName.cjs"),n=require("../../argentName.cjs"),i=require("../../getAddressFromArgentName.cjs");class A{constructor(e,r,t){this.httpService=e,this.baseUrl=r,this.allowedArgentNameNetworkId=t}async parseAddressOrDomain(e,r,t){if(d.isAddress(e))return d.normalizeAddress(e);try{return await this.getAddressFromDomainName(e,r,t)}catch{throw new s.AddressError({code:"NOT_VALID"})}}async getAddressFromDomainName(e,r,t){if(a.isStarknetId(e))return o.getAddressFromStarkName(e,r,t);if(n.isArgentName(e)){if(r!==this.allowedArgentNameNetworkId)throw new s.AddressError({code:"ARGENT_NAME_INVALID_NETWORK",message:`Argent name is only enabled on "${this.allowedArgentNameNetworkId}"`});return i.getAddressFromArgentName(e,this.httpService,this.baseUrl)}throw new s.AddressError({code:"NO_ADDRESS_FROM_DOMAIN"})}}exports.StarknetAddressService=A;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("../../address.cjs"),a=require("../../argentName.cjs"),o=require("../../getAddressFromArgentName.cjs"),n=require("../../getAddressFromStarkName.cjs"),i=require("../../starknetId.cjs"),s=require("../../../../errors/address.cjs");class A{constructor(e,r,t){this.httpService=e,this.baseUrl=r,this.allowedArgentNameNetworkId=t}async parseAddressOrDomain(e,r,t){if(d.isAddress(e))return d.normalizeAddress(e);try{return await this.getAddressFromDomainName(e,r,t)}catch{throw new s.AddressError({code:"NOT_VALID"})}}async getAddressFromDomainName(e,r,t){if(i.isStarknetId(e))return n.getAddressFromStarkName(e,r,t);if(a.isArgentName(e)){if(r!==this.allowedArgentNameNetworkId)throw new s.AddressError({code:"ARGENT_NAME_INVALID_NETWORK",message:`Argent name is only enabled on "${this.allowedArgentNameNetworkId}"`});return o.getAddressFromArgentName(e,this.httpService,this.baseUrl)}throw new s.AddressError({code:"NO_ADDRESS_FROM_DOMAIN"})}}exports.StarknetAddressService=A;
@@ -1,9 +1,9 @@
1
- import { AddressError as s } from "../../../../errors/address.js";
2
1
  import { isAddress as o, normalizeAddress as i } from "../../address.js";
3
- import { isStarknetId as m } from "../../starknetId.js";
4
- import { getAddressFromStarkName as a } from "../../getAddressFromStarkName.js";
5
- import { isArgentName as d } from "../../argentName.js";
6
- import { getAddressFromArgentName as n } from "../../getAddressFromArgentName.js";
2
+ import { isArgentName as m } from "../../argentName.js";
3
+ import { getAddressFromArgentName as a } from "../../getAddressFromArgentName.js";
4
+ import { getAddressFromStarkName as d } from "../../getAddressFromStarkName.js";
5
+ import { isStarknetId as n } from "../../starknetId.js";
6
+ import { AddressError as s } from "../../../../errors/address.js";
7
7
  class p {
8
8
  constructor(e, r, t) {
9
9
  this.httpService = e, this.baseUrl = r, this.allowedArgentNameNetworkId = t;
@@ -18,15 +18,15 @@ class p {
18
18
  }
19
19
  }
20
20
  async getAddressFromDomainName(e, r, t) {
21
- if (m(e))
22
- return a(e, r, t);
23
- if (d(e)) {
21
+ if (n(e))
22
+ return d(e, r, t);
23
+ if (m(e)) {
24
24
  if (r !== this.allowedArgentNameNetworkId)
25
25
  throw new s({
26
26
  code: "ARGENT_NAME_INVALID_NETWORK",
27
27
  message: `Argent name is only enabled on "${this.allowedArgentNameNetworkId}"`
28
28
  });
29
- return n(e, this.httpService, this.baseUrl);
29
+ return a(e, this.httpService, this.baseUrl);
30
30
  }
31
31
  throw new s({
32
32
  code: "NO_ADDRESS_FROM_DOMAIN"
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("zod"),a=require("../../utils/starknet/starknet.cjs"),t=require("../../backend/schema.cjs"),s=require("../../chains/starknet/address.cjs"),r=e.z.object({calls:e.z.array(a.callSchema),accountAddress:s.addressSchema,networkId:t.argentNetworkIdSchema.or(t.argentBackendNetworkIdSchema).optional(),feeTokenAddress:s.addressSchema,maxFee:a.bigNumberishSchema,accountClassHash:e.z.string().optional()}),c=e.z.object({signature:e.z.string().array(),accountAddress:s.addressSchema,typedData:a.typedDataSchema,networkId:t.argentNetworkIdSchema.optional()}),o=e.z.object({transactionHash:e.z.string()});exports.paymasterExecuteParams=c;exports.paymasterExecuteResponse=o;exports.paymasterExecutionDataParams=r;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("zod"),a=require("../../chains/starknet/address.cjs"),t=require("../../utils/starknet/starknet.cjs"),s=require("../../backend/schema.cjs"),r=e.z.object({calls:e.z.array(t.callSchema),accountAddress:a.addressSchema,networkId:s.argentNetworkIdSchema.or(s.argentBackendNetworkIdSchema).optional(),feeTokenAddress:a.addressSchema,maxFee:t.bigNumberishSchema,accountClassHash:e.z.string().optional()}),c=e.z.object({signature:e.z.string().array(),accountAddress:a.addressSchema,typedData:t.typedDataSchema,networkId:s.argentNetworkIdSchema.optional()}),o=e.z.object({transactionHash:e.z.string()});exports.paymasterExecuteParams=c;exports.paymasterExecuteResponse=o;exports.paymasterExecutionDataParams=r;
@@ -62,9 +62,9 @@ export declare const paymasterExecuteParams: z.ZodObject<{
62
62
  }>]>, "many">>;
63
63
  primaryType: z.ZodString;
64
64
  domain: z.ZodRecord<z.ZodString, z.ZodUnknown>;
65
- message: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
65
+ message: z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>]>;
66
66
  }, "strip", z.ZodTypeAny, {
67
- message: {};
67
+ message: Record<string, any> | z.objectOutputType<{}, z.ZodTypeAny, "passthrough">;
68
68
  types: Record<string, ({
69
69
  name: string;
70
70
  type: "merkletree";
@@ -80,7 +80,7 @@ export declare const paymasterExecuteParams: z.ZodObject<{
80
80
  primaryType: string;
81
81
  domain: Record<string, unknown>;
82
82
  }, {
83
- message: {};
83
+ message: Record<string, any> | z.objectInputType<{}, z.ZodTypeAny, "passthrough">;
84
84
  types: Record<string, ({
85
85
  name: string;
86
86
  type: "merkletree";
@@ -101,7 +101,7 @@ export declare const paymasterExecuteParams: z.ZodObject<{
101
101
  signature: string[];
102
102
  accountAddress: `0x${string}`;
103
103
  typedData: {
104
- message: {};
104
+ message: Record<string, any> | z.objectOutputType<{}, z.ZodTypeAny, "passthrough">;
105
105
  types: Record<string, ({
106
106
  name: string;
107
107
  type: "merkletree";
@@ -122,7 +122,7 @@ export declare const paymasterExecuteParams: z.ZodObject<{
122
122
  signature: string[];
123
123
  accountAddress: string;
124
124
  typedData: {
125
- message: {};
125
+ message: Record<string, any> | z.objectInputType<{}, z.ZodTypeAny, "passthrough">;
126
126
  types: Record<string, ({
127
127
  name: string;
128
128
  type: "merkletree";
@@ -1,7 +1,7 @@
1
1
  import { z as a } from "zod";
2
+ import { addressSchema as e } from "../../chains/starknet/address.js";
2
3
  import { bigNumberishSchema as r, callSchema as o, typedDataSchema as s } from "../../utils/starknet/starknet.js";
3
4
  import { argentNetworkIdSchema as t, argentBackendNetworkIdSchema as c } from "../../backend/schema.js";
4
- import { addressSchema as e } from "../../chains/starknet/address.js";
5
5
  const p = a.object({
6
6
  calls: a.array(o),
7
7
  accountAddress: e,
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../chains/starknet/services/deploymentData/getAccountClassHash.cjs"),o=require("../chains/starknet/constants.cjs"),t=require("../chains/starknet/address.cjs"),u=[o.STRK_TOKEN_ADDRESS];function n({address:e}){return u.some(s=>t.isEqualAddress(e,s))}function a(e){return e?r.getArgentAccountClassHashesWithTxV3Support().some(s=>t.isEqualAddress(s,e)):!1}exports.classHashSupportsTxV3=a;exports.feeTokenNeedsTxV3Support=n;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../chains/starknet/address.cjs"),r=require("../chains/starknet/constants.cjs"),o=require("../chains/starknet/services/deploymentData/getAccountClassHash.cjs"),u=[r.STRK_TOKEN_ADDRESS];function n({address:e}){return u.some(s=>t.isEqualAddress(e,s))}function a(e){return e?o.getArgentAccountClassHashesWithTxV3Support().some(s=>t.isEqualAddress(s,e)):!1}exports.classHashSupportsTxV3=a;exports.feeTokenNeedsTxV3Support=n;
@@ -1,12 +1,12 @@
1
- import { getArgentAccountClassHashesWithTxV3Support as t } from "../chains/starknet/services/deploymentData/getAccountClassHash.js";
2
- import { STRK_TOKEN_ADDRESS as s } from "../chains/starknet/constants.js";
3
1
  import { isEqualAddress as o } from "../chains/starknet/address.js";
4
- const n = [s];
2
+ import { STRK_TOKEN_ADDRESS as t } from "../chains/starknet/constants.js";
3
+ import { getArgentAccountClassHashesWithTxV3Support as s } from "../chains/starknet/services/deploymentData/getAccountClassHash.js";
4
+ const n = [t];
5
5
  function f({ address: r }) {
6
6
  return n.some((e) => o(r, e));
7
7
  }
8
8
  function m(r) {
9
- return r ? t().some((e) => o(e, r)) : !1;
9
+ return r ? s().some((e) => o(e, r)) : !1;
10
10
  }
11
11
  export {
12
12
  m as classHashSupportsTxV3,
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("zod"),h=require("../../chains/starknet/address.cjs"),t=a.z.union([a.z.string(),a.z.number(),a.z.bigint()]),l=a.z.object({low:t,high:t}),o=a.z.array(a.z.string()).and(a.z.object({__compiled__:a.z.boolean().optional()}).optional()),s=a.z.lazy(()=>a.z.array(a.z.union([r,a.z.array(r),c]))),r=a.z.union([t,l,a.z.any(),a.z.boolean()]),i=a.z.lazy(()=>a.z.record(a.z.union([r,a.z.array(r),c]))),c=a.z.lazy(()=>a.z.union([i,s])),z=a.z.union([c,o]).optional(),m=a.z.lazy(()=>a.z.object({contractAddress:a.z.string(),calldata:z,entrypoint:a.z.string().optional()})),d=a.z.lazy(()=>m.and(a.z.object({entrypoint:a.z.string()}))),e=a.z.string().refine(n=>typeof parseInt(n)=="number"),S=a.z.tuple([e]),g=a.z.tuple([e]),u=a.z.object({new_threshold:a.z.string().refine(n=>typeof parseInt(n)=="number"),signers_to_add:a.z.array(e)}),p=a.z.object({new_threshold:a.z.string().refine(n=>typeof parseInt(n)=="number"),signers_to_remove:a.z.array(e)}),y=a.z.object({signer_to_remove:e,signer_to_add:e}),b=a.z.tuple([e]),C=a.z.tuple([e]),j=a.z.tuple([e]),w=a.z.tuple([e]).rest(e),_=a.z.object({recipient:h.addressSchema,amount:a.z.object({low:t,high:t})}),f=a.z.object({types:a.z.record(a.z.array(a.z.union([a.z.object({name:a.z.string(),type:a.z.literal("merkletree"),contains:a.z.string()}),a.z.object({name:a.z.string(),type:a.z.literal("enum"),contains:a.z.string()}),a.z.object({name:a.z.string(),type:a.z.string()})]))),primaryType:a.z.string(),domain:a.z.record(a.z.unknown()),message:a.z.object({})});exports.addOwnersCalldataSchema=u;exports.addPluginCalldataSchema=C;exports.bigNumberishSchema=t;exports.callDetailsSchema=m;exports.callSchema=d;exports.calldataSchema=o;exports.changeGuardianCalldataSchema=S;exports.changeThresholdCalldataSchema=b;exports.escapeGuardianCalldataSchema=g;exports.executeOnPluginCalldataSchema=w;exports.feltSchema=e;exports.looseCalldataSchema=z;exports.multiTypeSchema=r;exports.rawArgsArraySchema=s;exports.rawArgsObjectSchema=i;exports.rawArgsSchema=c;exports.removeOwnersCalldataSchema=p;exports.removePluginCalldataSchema=j;exports.replaceSignerCalldataSchema=y;exports.transferCalldataSchema=_;exports.typedDataSchema=f;exports.uint256Schema=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("zod"),h=require("../../chains/starknet/address.cjs"),t=a.z.union([a.z.string(),a.z.number(),a.z.bigint()]),l=a.z.object({low:t,high:t}),o=a.z.array(a.z.string()).and(a.z.object({__compiled__:a.z.boolean().optional()}).optional()),s=a.z.lazy(()=>a.z.array(a.z.union([r,a.z.array(r),c]))),r=a.z.union([t,l,a.z.any(),a.z.boolean()]),i=a.z.lazy(()=>a.z.record(a.z.union([r,a.z.array(r),c]))),c=a.z.lazy(()=>a.z.union([i,s])),z=a.z.union([c,o]).optional(),m=a.z.lazy(()=>a.z.object({contractAddress:a.z.string(),calldata:z,entrypoint:a.z.string().optional()})),d=a.z.lazy(()=>m.and(a.z.object({entrypoint:a.z.string()}))),e=a.z.string().refine(n=>typeof parseInt(n)=="number"),S=a.z.tuple([e]),g=a.z.tuple([e]),u=a.z.object({new_threshold:a.z.string().refine(n=>typeof parseInt(n)=="number"),signers_to_add:a.z.array(e)}),p=a.z.object({new_threshold:a.z.string().refine(n=>typeof parseInt(n)=="number"),signers_to_remove:a.z.array(e)}),y=a.z.object({signer_to_remove:e,signer_to_add:e}),b=a.z.tuple([e]),C=a.z.tuple([e]),j=a.z.tuple([e]),w=a.z.tuple([e]).rest(e),_=a.z.object({recipient:h.addressSchema,amount:a.z.object({low:t,high:t})}),f=a.z.object({types:a.z.record(a.z.array(a.z.union([a.z.object({name:a.z.string(),type:a.z.literal("merkletree"),contains:a.z.string()}),a.z.object({name:a.z.string(),type:a.z.literal("enum"),contains:a.z.string()}),a.z.object({name:a.z.string(),type:a.z.string()})]))),primaryType:a.z.string(),domain:a.z.record(a.z.unknown()),message:a.z.record(a.z.string(),a.z.any()).or(a.z.object({}).passthrough())});exports.addOwnersCalldataSchema=u;exports.addPluginCalldataSchema=C;exports.bigNumberishSchema=t;exports.callDetailsSchema=m;exports.callSchema=d;exports.calldataSchema=o;exports.changeGuardianCalldataSchema=S;exports.changeThresholdCalldataSchema=b;exports.escapeGuardianCalldataSchema=g;exports.executeOnPluginCalldataSchema=w;exports.feltSchema=e;exports.looseCalldataSchema=z;exports.multiTypeSchema=r;exports.rawArgsArraySchema=s;exports.rawArgsObjectSchema=i;exports.rawArgsSchema=c;exports.removeOwnersCalldataSchema=p;exports.removePluginCalldataSchema=j;exports.replaceSignerCalldataSchema=y;exports.transferCalldataSchema=_;exports.typedDataSchema=f;exports.uint256Schema=l;
@@ -139,9 +139,9 @@ export declare const typedDataSchema: z.ZodObject<{
139
139
  }>]>, "many">>;
140
140
  primaryType: z.ZodString;
141
141
  domain: z.ZodRecord<z.ZodString, z.ZodUnknown>;
142
- message: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
142
+ message: z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>]>;
143
143
  }, "strip", z.ZodTypeAny, {
144
- message: {};
144
+ message: Record<string, any> | z.objectOutputType<{}, z.ZodTypeAny, "passthrough">;
145
145
  types: Record<string, ({
146
146
  name: string;
147
147
  type: "merkletree";
@@ -157,7 +157,7 @@ export declare const typedDataSchema: z.ZodObject<{
157
157
  primaryType: string;
158
158
  domain: Record<string, unknown>;
159
159
  }, {
160
- message: {};
160
+ message: Record<string, any> | z.objectInputType<{}, z.ZodTypeAny, "passthrough">;
161
161
  types: Record<string, ({
162
162
  name: string;
163
163
  type: "merkletree";
@@ -50,7 +50,7 @@ const n = a.union([a.string(), a.number(), a.bigint()]), s = a.object({
50
50
  ]))),
51
51
  primaryType: a.string(),
52
52
  domain: a.record(a.unknown()),
53
- message: a.object({})
53
+ message: a.record(a.string(), a.any()).or(a.object({}).passthrough())
54
54
  });
55
55
  export {
56
56
  S as addOwnersCalldataSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@argent/x-shared",
3
- "version": "1.62.0",
3
+ "version": "1.62.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/argentlabs/x-shared.git"