@spritz-finance/service-client 0.21.0 → 0.23.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.
@@ -27,9 +27,25 @@ export type IntegratorWebhook = {
27
27
  url: string;
28
28
  createdAt: string;
29
29
  };
30
+ /**
31
+ * What a code lookup returns: enough to identify the partner behind a code, and
32
+ * deliberately no credentials — integrator codes are sequential and guessable.
33
+ */
34
+ export type IntegratorReference = {
35
+ id: string;
36
+ name: string;
37
+ code: string | null;
38
+ deletedAt: string | null;
39
+ };
30
40
  export type Integrator = {
31
41
  id: string;
32
42
  name: string;
43
+ /**
44
+ * Compliance-facing integrator code (INT-001). Permanent and never reused.
45
+ * Absent only for integrators created before codes were introduced and not
46
+ * yet backfilled.
47
+ */
48
+ code?: string;
33
49
  email: string;
34
50
  canSubsidizeUserFees: boolean;
35
51
  kycThemeSetId?: string;
@@ -1,5 +1,5 @@
1
1
  export * as UsersClient from "./usersServiceClient";
2
- import { Integrator, IntegratorWebhook, User } from "./types";
2
+ import { Integrator, IntegratorReference, IntegratorWebhook, User } from "./types";
3
3
  export declare function getActiveUsers(): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<string[]>>;
4
4
  export declare function getUserById(id: string): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<User>>;
5
5
  export declare function setMembership(userId: string, membership: string): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<User>>;
@@ -12,3 +12,8 @@ export declare function validateAdIdentifiers(adIdentifiers?: {
12
12
  }): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<boolean>>;
13
13
  export declare function getIntegratorWebhooks(integratorId: string): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<IntegratorWebhook[]>>;
14
14
  export declare function getIntegrator(integratorId: string): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<Integrator | null>>;
15
+ /**
16
+ * Reverse-resolves a compliance code (INT-001) to the integrator that owns it.
17
+ * Returns identity only — use `getIntegrator` when you need the full record.
18
+ */
19
+ export declare function getIntegratorByCode(code: string): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<IntegratorReference>>;
@@ -42,6 +42,7 @@ exports.findByEmail = findByEmail;
42
42
  exports.validateAdIdentifiers = validateAdIdentifiers;
43
43
  exports.getIntegratorWebhooks = getIntegratorWebhooks;
44
44
  exports.getIntegrator = getIntegrator;
45
+ exports.getIntegratorByCode = getIntegratorByCode;
45
46
  exports.UsersClient = __importStar(require("./usersServiceClient"));
46
47
  const serviceClient_1 = require("../serviceClient");
47
48
  const NEW_USER_ENDPOINT = "/v2/users/api";
@@ -89,3 +90,12 @@ async function getIntegrator(integratorId) {
89
90
  .get(`${NEW_USER_ENDPOINT}/integrators/${integratorId}`)
90
91
  .then((res) => res.data);
91
92
  }
93
+ /**
94
+ * Reverse-resolves a compliance code (INT-001) to the integrator that owns it.
95
+ * Returns identity only — use `getIntegrator` when you need the full record.
96
+ */
97
+ async function getIntegratorByCode(code) {
98
+ return serviceClient_1.baseClient
99
+ .get(`${NEW_USER_ENDPOINT}/integrators/by-code?code=${encodeURIComponent(code)}`)
100
+ .then((res) => res.data);
101
+ }
@@ -116,6 +116,7 @@ export type ListListedKaminoVaultIdsResponse = {
116
116
  export type UserOpsSigner = {
117
117
  id: string;
118
118
  userId: string;
119
+ walletId?: string;
119
120
  curve: string;
120
121
  pathFormat: string;
121
122
  seedIndex: number;
@@ -126,5 +127,15 @@ export type UserOpsSigner = {
126
127
  entryPointVersion: string;
127
128
  };
128
129
  address: string;
130
+ stagedAt?: string;
131
+ retiredAt?: string;
129
132
  createdAt: string;
130
133
  };
134
+ export type OpsSignerMigrationState = {
135
+ requiresMigration: boolean;
136
+ sourceSigner: UserOpsSigner;
137
+ targetSigner?: UserOpsSigner;
138
+ };
139
+ export type OpsSignerReplacement = OpsSignerMigrationState & {
140
+ targetSigner: UserOpsSigner;
141
+ };
@@ -1,5 +1,5 @@
1
1
  export * as Web3Client from "./web3ServiceClient";
2
- import { ExactInQuoteInput, ExactInQuoteResponse, ListListedKaminoVaultIdsInput, ListListedKaminoVaultIdsResponse, OpsSignerType, Portfolio, SignerUsageType, SolanaPaymentBuildInput, SolanaPaymentBuildResult, TokenBalance, UserOpsSigner, WalletTokenBalanceInput } from "./types";
2
+ import { ExactInQuoteInput, ExactInQuoteResponse, ListListedKaminoVaultIdsInput, ListListedKaminoVaultIdsResponse, OpsSignerMigrationState, OpsSignerReplacement, OpsSignerType, Portfolio, SignerUsageType, SolanaPaymentBuildInput, SolanaPaymentBuildResult, TokenBalance, UserOpsSigner, WalletTokenBalanceInput } from "./types";
3
3
  export declare function getExactInQuote(input: ExactInQuoteInput): Promise<ExactInQuoteResponse>;
4
4
  export declare function getTokenBalances(input: WalletTokenBalanceInput): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<TokenBalance[]>>;
5
5
  export declare function getPortfolio(address: string): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<Portfolio>>;
@@ -24,5 +24,18 @@ export declare function ensureUserOpsSigner(input: {
24
24
  userId: string;
25
25
  signerType: OpsSignerType;
26
26
  }): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<UserOpsSigner>>;
27
+ /**
28
+ * Creates an inactive signer in the current ops wallet for a legacy user. The
29
+ * existing signer remains active until its consumer completes the external
30
+ * authorisation cutover.
31
+ */
32
+ export declare function stageUserOpsSignerReplacement(input: {
33
+ userId: string;
34
+ signerType: OpsSignerType;
35
+ }): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<OpsSignerReplacement>>;
36
+ export declare function getUserOpsSignerReplacement(input: {
37
+ userId: string;
38
+ signerType: OpsSignerType;
39
+ }): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<OpsSignerMigrationState>>;
27
40
  export declare function buildSolanaPayment(input: SolanaPaymentBuildInput): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<SolanaPaymentBuildResult>>;
28
41
  export declare function listListedKaminoVaultIds(input?: ListListedKaminoVaultIdsInput): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<ListListedKaminoVaultIdsResponse>>;
@@ -41,6 +41,8 @@ exports.getUserOpsSigner = getUserOpsSigner;
41
41
  exports.getUserOpsSignerByAddress = getUserOpsSignerByAddress;
42
42
  exports.getSmartAccountAddress = getSmartAccountAddress;
43
43
  exports.ensureUserOpsSigner = ensureUserOpsSigner;
44
+ exports.stageUserOpsSignerReplacement = stageUserOpsSignerReplacement;
45
+ exports.getUserOpsSignerReplacement = getUserOpsSignerReplacement;
44
46
  exports.buildSolanaPayment = buildSolanaPayment;
45
47
  exports.listListedKaminoVaultIds = listListedKaminoVaultIds;
46
48
  exports.Web3Client = __importStar(require("./web3ServiceClient"));
@@ -88,6 +90,21 @@ async function ensureUserOpsSigner(input) {
88
90
  .post(`${WEB3_ENDPOINT}/ops-signer/user/${input.userId}?signerType=${input.signerType}`)
89
91
  .then((res) => res.data);
90
92
  }
93
+ /**
94
+ * Creates an inactive signer in the current ops wallet for a legacy user. The
95
+ * existing signer remains active until its consumer completes the external
96
+ * authorisation cutover.
97
+ */
98
+ async function stageUserOpsSignerReplacement(input) {
99
+ return serviceClient_1.baseClient
100
+ .post(`${WEB3_V2_ENDPOINT}/ops-signers/${input.userId}/replacement?signerType=${input.signerType}`)
101
+ .then((res) => res.data);
102
+ }
103
+ async function getUserOpsSignerReplacement(input) {
104
+ return serviceClient_1.baseClient
105
+ .get(`${WEB3_V2_ENDPOINT}/ops-signers/${input.userId}/replacement?signerType=${input.signerType}`)
106
+ .then((res) => res.data);
107
+ }
91
108
  async function buildSolanaPayment(input) {
92
109
  return serviceClient_1.baseClient
93
110
  .post(`${WEB3_V2_ENDPOINT}/solana-payment/build`, input)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spritz-finance/service-client",
3
- "version": "0.21.0",
3
+ "version": "0.23.0",
4
4
  "gitHead": "06f8e96b7b38c34df26a38da329331940675e4f8",
5
5
  "description": "Service client",
6
6
  "license": "ISC",