@boundlessfi/identity-sdk 0.1.1 → 0.1.3

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 (42) hide show
  1. package/dist/index.cjs +441 -0
  2. package/dist/index.cjs.map +1 -0
  3. package/dist/index.d.cts +157 -0
  4. package/dist/index.d.ts +157 -7
  5. package/dist/index.js +423 -6
  6. package/dist/index.js.map +1 -1
  7. package/dist/server/index.cjs +80 -0
  8. package/dist/server/index.cjs.map +1 -0
  9. package/dist/server/index.d.cts +35 -0
  10. package/dist/server/index.d.ts +35 -2
  11. package/dist/server/index.js +52 -1
  12. package/dist/server/index.js.map +1 -1
  13. package/package.json +10 -5
  14. package/src/boundless-sdk.ts +13 -3
  15. package/src/server/stellar-plugin.ts +39 -48
  16. package/tsup.config.ts +11 -0
  17. package/dist/boundless-sdk.d.ts +0 -69
  18. package/dist/boundless-sdk.d.ts.map +0 -1
  19. package/dist/boundless-sdk.js +0 -373
  20. package/dist/boundless-sdk.js.map +0 -1
  21. package/dist/constants.d.ts +0 -32
  22. package/dist/constants.d.ts.map +0 -1
  23. package/dist/constants.js +0 -31
  24. package/dist/constants.js.map +0 -1
  25. package/dist/errors.d.ts +0 -9
  26. package/dist/errors.d.ts.map +0 -1
  27. package/dist/errors.js +0 -16
  28. package/dist/errors.js.map +0 -1
  29. package/dist/index.d.ts.map +0 -1
  30. package/dist/server/index.d.ts.map +0 -1
  31. package/dist/server/stellar-plugin.d.ts +0 -3
  32. package/dist/server/stellar-plugin.d.ts.map +0 -1
  33. package/dist/server/stellar-plugin.js +0 -51
  34. package/dist/server/stellar-plugin.js.map +0 -1
  35. package/dist/types.d.ts +0 -33
  36. package/dist/types.d.ts.map +0 -1
  37. package/dist/types.js +0 -4
  38. package/dist/types.js.map +0 -1
  39. package/dist/utils.d.ts +0 -14
  40. package/dist/utils.d.ts.map +0 -1
  41. package/dist/utils.js +0 -20
  42. package/dist/utils.js.map +0 -1
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/server/index.ts
21
+ var server_exports = {};
22
+ __export(server_exports, {
23
+ boundlessStellarPlugin: () => boundlessStellarPlugin
24
+ });
25
+ module.exports = __toCommonJS(server_exports);
26
+
27
+ // src/server/stellar-plugin.ts
28
+ var import_api = require("better-auth/api");
29
+ var import_zod = require("zod");
30
+ var boundlessStellarPlugin = () => {
31
+ return {
32
+ id: "boundless-stellar",
33
+ // Extend the User table to store Stellar data
34
+ schema: {
35
+ user: {
36
+ fields: {
37
+ stellarAddress: { type: "string", required: false, input: false },
38
+ credentialId: { type: "string", required: false, input: false }
39
+ // From WebAuthn
40
+ }
41
+ }
42
+ },
43
+ endpoints: {
44
+ // Endpoint to link a deployed wallet to a session
45
+ linkStellarAccount: (0, import_api.createAuthEndpoint)(
46
+ "/stellar/link",
47
+ {
48
+ method: "POST",
49
+ body: import_zod.z.object({
50
+ stellarAddress: import_zod.z.string().min(56).max(56).regex(/^C[A-Z0-9]{55}$/, "Invalid Stellar address format"),
51
+ credentialId: import_zod.z.string().min(1, "Credential ID is required")
52
+ })
53
+ },
54
+ async (ctx) => {
55
+ if (!ctx.context.session) {
56
+ return ctx.json(
57
+ { success: false, error: "Unauthorized" },
58
+ { status: 401 }
59
+ );
60
+ }
61
+ const { stellarAddress, credentialId } = ctx.body;
62
+ await ctx.context.adapter.update({
63
+ model: "user",
64
+ where: [{ field: "id", value: ctx.context.session.user.id }],
65
+ update: {
66
+ stellarAddress,
67
+ credentialId
68
+ }
69
+ });
70
+ return ctx.json({ success: true });
71
+ }
72
+ )
73
+ }
74
+ };
75
+ };
76
+ // Annotate the CommonJS export names for ESM import in node:
77
+ 0 && (module.exports = {
78
+ boundlessStellarPlugin
79
+ });
80
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/server/index.ts","../../src/server/stellar-plugin.ts"],"sourcesContent":["export { boundlessStellarPlugin } from \"./stellar-plugin\";\n","import type { BetterAuthPlugin } from \"better-auth\";\nimport { createAuthEndpoint } from \"better-auth/api\";\nimport { z } from \"zod\";\n\nexport const boundlessStellarPlugin = () => {\n return {\n id: \"boundless-stellar\",\n // Extend the User table to store Stellar data\n schema: {\n user: {\n fields: {\n stellarAddress: { type: \"string\", required: false, input: false },\n credentialId: { type: \"string\", required: false, input: false }, // From WebAuthn\n },\n },\n },\n endpoints: {\n // Endpoint to link a deployed wallet to a session\n linkStellarAccount: createAuthEndpoint(\n \"/stellar/link\",\n {\n method: \"POST\",\n body: z.object({\n stellarAddress: z\n .string()\n .min(56)\n .max(56)\n .regex(/^C[A-Z0-9]{55}$/, \"Invalid Stellar address format\"),\n credentialId: z.string().min(1, \"Credential ID is required\"),\n }),\n },\n async (ctx) => {\n if (!ctx.context.session) {\n return ctx.json(\n { success: false, error: \"Unauthorized\" },\n { status: 401 },\n );\n }\n\n const { stellarAddress, credentialId } = ctx.body;\n\n // Logic to update the authenticated user's record in the DB\n\n await ctx.context.adapter.update({\n model: \"user\",\n where: [{ field: \"id\", value: ctx.context.session.user.id }],\n update: {\n stellarAddress,\n credentialId,\n },\n });\n return ctx.json({ success: true });\n },\n ),\n },\n } satisfies BetterAuthPlugin;\n};\n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* as better_auth from 'better-auth';
2
+ import { z } from 'zod';
3
+
4
+ declare const boundlessStellarPlugin: () => {
5
+ id: "boundless-stellar";
6
+ schema: {
7
+ user: {
8
+ fields: {
9
+ stellarAddress: {
10
+ type: "string";
11
+ required: false;
12
+ input: false;
13
+ };
14
+ credentialId: {
15
+ type: "string";
16
+ required: false;
17
+ input: false;
18
+ };
19
+ };
20
+ };
21
+ };
22
+ endpoints: {
23
+ linkStellarAccount: better_auth.StrictEndpoint<"/stellar/link", {
24
+ method: "POST";
25
+ body: z.ZodObject<{
26
+ stellarAddress: z.ZodString;
27
+ credentialId: z.ZodString;
28
+ }, z.core.$strip>;
29
+ }, {
30
+ success: boolean;
31
+ }>;
32
+ };
33
+ };
34
+
35
+ export { boundlessStellarPlugin };
@@ -1,2 +1,35 @@
1
- export { boundlessStellarPlugin } from "./stellar-plugin";
2
- //# sourceMappingURL=index.d.ts.map
1
+ import * as better_auth from 'better-auth';
2
+ import { z } from 'zod';
3
+
4
+ declare const boundlessStellarPlugin: () => {
5
+ id: "boundless-stellar";
6
+ schema: {
7
+ user: {
8
+ fields: {
9
+ stellarAddress: {
10
+ type: "string";
11
+ required: false;
12
+ input: false;
13
+ };
14
+ credentialId: {
15
+ type: "string";
16
+ required: false;
17
+ input: false;
18
+ };
19
+ };
20
+ };
21
+ };
22
+ endpoints: {
23
+ linkStellarAccount: better_auth.StrictEndpoint<"/stellar/link", {
24
+ method: "POST";
25
+ body: z.ZodObject<{
26
+ stellarAddress: z.ZodString;
27
+ credentialId: z.ZodString;
28
+ }, z.core.$strip>;
29
+ }, {
30
+ success: boolean;
31
+ }>;
32
+ };
33
+ };
34
+
35
+ export { boundlessStellarPlugin };
@@ -1,2 +1,53 @@
1
- export { boundlessStellarPlugin } from "./stellar-plugin";
1
+ // src/server/stellar-plugin.ts
2
+ import { createAuthEndpoint } from "better-auth/api";
3
+ import { z } from "zod";
4
+ var boundlessStellarPlugin = () => {
5
+ return {
6
+ id: "boundless-stellar",
7
+ // Extend the User table to store Stellar data
8
+ schema: {
9
+ user: {
10
+ fields: {
11
+ stellarAddress: { type: "string", required: false, input: false },
12
+ credentialId: { type: "string", required: false, input: false }
13
+ // From WebAuthn
14
+ }
15
+ }
16
+ },
17
+ endpoints: {
18
+ // Endpoint to link a deployed wallet to a session
19
+ linkStellarAccount: createAuthEndpoint(
20
+ "/stellar/link",
21
+ {
22
+ method: "POST",
23
+ body: z.object({
24
+ stellarAddress: z.string().min(56).max(56).regex(/^C[A-Z0-9]{55}$/, "Invalid Stellar address format"),
25
+ credentialId: z.string().min(1, "Credential ID is required")
26
+ })
27
+ },
28
+ async (ctx) => {
29
+ if (!ctx.context.session) {
30
+ return ctx.json(
31
+ { success: false, error: "Unauthorized" },
32
+ { status: 401 }
33
+ );
34
+ }
35
+ const { stellarAddress, credentialId } = ctx.body;
36
+ await ctx.context.adapter.update({
37
+ model: "user",
38
+ where: [{ field: "id", value: ctx.context.session.user.id }],
39
+ update: {
40
+ stellarAddress,
41
+ credentialId
42
+ }
43
+ });
44
+ return ctx.json({ success: true });
45
+ }
46
+ )
47
+ }
48
+ };
49
+ };
50
+ export {
51
+ boundlessStellarPlugin
52
+ };
2
53
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"sources":["../../src/server/stellar-plugin.ts"],"sourcesContent":["import type { BetterAuthPlugin } from \"better-auth\";\nimport { createAuthEndpoint } from \"better-auth/api\";\nimport { z } from \"zod\";\n\nexport const boundlessStellarPlugin = () => {\n return {\n id: \"boundless-stellar\",\n // Extend the User table to store Stellar data\n schema: {\n user: {\n fields: {\n stellarAddress: { type: \"string\", required: false, input: false },\n credentialId: { type: \"string\", required: false, input: false }, // From WebAuthn\n },\n },\n },\n endpoints: {\n // Endpoint to link a deployed wallet to a session\n linkStellarAccount: createAuthEndpoint(\n \"/stellar/link\",\n {\n method: \"POST\",\n body: z.object({\n stellarAddress: z\n .string()\n .min(56)\n .max(56)\n .regex(/^C[A-Z0-9]{55}$/, \"Invalid Stellar address format\"),\n credentialId: z.string().min(1, \"Credential ID is required\"),\n }),\n },\n async (ctx) => {\n if (!ctx.context.session) {\n return ctx.json(\n { success: false, error: \"Unauthorized\" },\n { status: 401 },\n );\n }\n\n const { stellarAddress, credentialId } = ctx.body;\n\n // Logic to update the authenticated user's record in the DB\n\n await ctx.context.adapter.update({\n model: \"user\",\n where: [{ field: \"id\", value: ctx.context.session.user.id }],\n update: {\n stellarAddress,\n credentialId,\n },\n });\n return ctx.json({ success: true });\n },\n ),\n },\n } satisfies BetterAuthPlugin;\n};\n"],"mappings":";AACA,SAAS,0BAA0B;AACnC,SAAS,SAAS;AAEX,IAAM,yBAAyB,MAAM;AAC1C,SAAO;AAAA,IACL,IAAI;AAAA;AAAA,IAEJ,QAAQ;AAAA,MACN,MAAM;AAAA,QACJ,QAAQ;AAAA,UACN,gBAAgB,EAAE,MAAM,UAAU,UAAU,OAAO,OAAO,MAAM;AAAA,UAChE,cAAc,EAAE,MAAM,UAAU,UAAU,OAAO,OAAO,MAAM;AAAA;AAAA,QAChE;AAAA,MACF;AAAA,IACF;AAAA,IACA,WAAW;AAAA;AAAA,MAET,oBAAoB;AAAA,QAClB;AAAA,QACA;AAAA,UACE,QAAQ;AAAA,UACR,MAAM,EAAE,OAAO;AAAA,YACb,gBAAgB,EACb,OAAO,EACP,IAAI,EAAE,EACN,IAAI,EAAE,EACN,MAAM,mBAAmB,gCAAgC;AAAA,YAC5D,cAAc,EAAE,OAAO,EAAE,IAAI,GAAG,2BAA2B;AAAA,UAC7D,CAAC;AAAA,QACH;AAAA,QACA,OAAO,QAAQ;AACb,cAAI,CAAC,IAAI,QAAQ,SAAS;AACxB,mBAAO,IAAI;AAAA,cACT,EAAE,SAAS,OAAO,OAAO,eAAe;AAAA,cACxC,EAAE,QAAQ,IAAI;AAAA,YAChB;AAAA,UACF;AAEA,gBAAM,EAAE,gBAAgB,aAAa,IAAI,IAAI;AAI7C,gBAAM,IAAI,QAAQ,QAAQ,OAAO;AAAA,YAC/B,OAAO;AAAA,YACP,OAAO,CAAC,EAAE,OAAO,MAAM,OAAO,IAAI,QAAQ,QAAQ,KAAK,GAAG,CAAC;AAAA,YAC3D,QAAQ;AAAA,cACN;AAAA,cACA;AAAA,YACF;AAAA,UACF,CAAC;AACD,iBAAO,IAAI,KAAK,EAAE,SAAS,KAAK,CAAC;AAAA,QACnC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
package/package.json CHANGED
@@ -1,35 +1,40 @@
1
1
  {
2
2
  "name": "@boundlessfi/identity-sdk",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "private": false,
5
5
  "type": "module",
6
- "main": "./dist/index.js",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
7
8
  "types": "./dist/index.d.ts",
8
9
  "exports": {
9
10
  ".": {
10
11
  "import": "./dist/index.js",
12
+ "require": "./dist/index.cjs",
11
13
  "types": "./dist/index.d.ts"
12
14
  },
13
15
  "./server": {
14
16
  "import": "./dist/server/index.js",
17
+ "require": "./dist/server/index.cjs",
15
18
  "types": "./dist/server/index.d.ts"
16
19
  }
17
20
  },
18
21
  "dependencies": {
19
22
  "@stellar/stellar-sdk": "^14.5.0",
20
23
  "better-auth": "latest",
21
- "smart-account-kit": "latest"
24
+ "smart-account-kit": "latest",
25
+ "zod": "^4.3.6"
22
26
  },
23
27
  "peerDependencies": {
24
28
  "smart-account-kit": ">=1.0.0"
25
29
  },
26
30
  "devDependencies": {
31
+ "tsup": "^8.0.2",
27
32
  "tsx": "^4.7",
28
33
  "typescript": "^5.4"
29
34
  },
30
35
  "scripts": {
31
- "build": "tsc",
32
- "dev": "tsx watch src/index.ts"
36
+ "build": "tsup",
37
+ "dev": "tsup --watch"
33
38
  },
34
39
  "license": "MIT"
35
40
  }
@@ -138,7 +138,11 @@ export class BoundlessSDK {
138
138
  });
139
139
 
140
140
  // 2. Link to Better-Auth session
141
- await this.linkToSession(result.contractId);
141
+ // We expect credentialId to be present for new registrations via SmartAccountKit
142
+ if (!result.credentialId) {
143
+ console.warn("No credentialId returned from createWallet for new user.");
144
+ }
145
+ await this.linkToSession(result.contractId, result.credentialId || "");
142
146
 
143
147
  this._walletAddress = result.contractId;
144
148
 
@@ -153,7 +157,10 @@ export class BoundlessSDK {
153
157
  /**
154
158
  * Link a Stellar wallet address to the currently authenticated user session.
155
159
  */
156
- private async linkToSession(contractId: string): Promise<void> {
160
+ private async linkToSession(
161
+ contractId: string,
162
+ credentialId: string,
163
+ ): Promise<void> {
157
164
  // 1. Check session
158
165
  const res = await this.authClient.getSession();
159
166
  const session = res?.data;
@@ -173,7 +180,10 @@ export class BoundlessSDK {
173
180
  headers: {
174
181
  "Content-Type": "application/json",
175
182
  },
176
- body: JSON.stringify({ stellarAddress: contractId }),
183
+ body: JSON.stringify({
184
+ stellarAddress: contractId,
185
+ credentialId: credentialId,
186
+ }),
177
187
  // Credentials include cookies for the session
178
188
  credentials: "include",
179
189
  });
@@ -1,66 +1,57 @@
1
1
  import type { BetterAuthPlugin } from "better-auth";
2
+ import { createAuthEndpoint } from "better-auth/api";
3
+ import { z } from "zod";
2
4
 
3
- export const boundlessStellarPlugin = (): BetterAuthPlugin =>
4
- ({
5
+ export const boundlessStellarPlugin = () => {
6
+ return {
5
7
  id: "boundless-stellar",
6
-
8
+ // Extend the User table to store Stellar data
7
9
  schema: {
8
10
  user: {
9
11
  fields: {
10
- stellarAddress: {
11
- type: "string",
12
- required: false,
13
- unique: true,
14
- },
15
- credentialId: {
16
- type: "string",
17
- required: false,
18
- },
12
+ stellarAddress: { type: "string", required: false, input: false },
13
+ credentialId: { type: "string", required: false, input: false }, // From WebAuthn
19
14
  },
20
15
  },
21
16
  },
22
-
23
17
  endpoints: {
24
- linkStellar: {
25
- path: "/stellar/link",
26
- method: ["POST"],
27
- handler: async (ctx: any) => {
28
- // ctx is the Better-Auth handler context.
29
- // ctx.request.body contains the parsed JSON.
30
- // ctx.context.db is the database adapter.
31
- // ctx.context.session.user is the authenticated user (or null).
32
-
33
- const session = await ctx.context.auth.getSession(ctx.request);
34
- if (!session?.user) {
35
- return ctx.json({ error: "Unauthorized" }, { status: 401 });
36
- }
37
-
38
- const body = ctx.request.body as { stellarAddress?: unknown };
39
- const { stellarAddress } = body;
40
-
41
- // Validate C-address format
42
- if (
43
- typeof stellarAddress !== "string" ||
44
- stellarAddress.length !== 56 ||
45
- !stellarAddress.startsWith("C")
46
- ) {
18
+ // Endpoint to link a deployed wallet to a session
19
+ linkStellarAccount: createAuthEndpoint(
20
+ "/stellar/link",
21
+ {
22
+ method: "POST",
23
+ body: z.object({
24
+ stellarAddress: z
25
+ .string()
26
+ .min(56)
27
+ .max(56)
28
+ .regex(/^C[A-Z0-9]{55}$/, "Invalid Stellar address format"),
29
+ credentialId: z.string().min(1, "Credential ID is required"),
30
+ }),
31
+ },
32
+ async (ctx) => {
33
+ if (!ctx.context.session) {
47
34
  return ctx.json(
48
- {
49
- error:
50
- "Invalid stellarAddress. Must be a 56-char Soroban contract ID starting with C.",
51
- },
52
- { status: 400 },
35
+ { success: false, error: "Unauthorized" },
36
+ { status: 401 },
53
37
  );
54
38
  }
55
39
 
56
- // Persist
57
- await ctx.context.db.update("user", {
58
- where: { id: session.user.id },
59
- update: { stellarAddress },
60
- });
40
+ const { stellarAddress, credentialId } = ctx.body;
41
+
42
+ // Logic to update the authenticated user's record in the DB
61
43
 
44
+ await ctx.context.adapter.update({
45
+ model: "user",
46
+ where: [{ field: "id", value: ctx.context.session.user.id }],
47
+ update: {
48
+ stellarAddress,
49
+ credentialId,
50
+ },
51
+ });
62
52
  return ctx.json({ success: true });
63
53
  },
64
- },
54
+ ),
65
55
  },
66
- }) as any;
56
+ } satisfies BetterAuthPlugin;
57
+ };
package/tsup.config.ts ADDED
@@ -0,0 +1,11 @@
1
+ import { defineConfig } from "tsup";
2
+
3
+ export default defineConfig({
4
+ entry: ["src/index.ts", "src/server/index.ts"],
5
+ format: ["cjs", "esm"],
6
+ dts: true,
7
+ splitting: false,
8
+ sourcemap: true,
9
+ clean: true,
10
+ target: "es2020",
11
+ });
@@ -1,69 +0,0 @@
1
- import { SmartAccountKit } from "smart-account-kit";
2
- import type { AssembledTransaction } from "smart-account-kit";
3
- import type { BoundlessSdkConfig, ConnectOptions, ConnectResult, SignAndSubmitResult, AddRecoveryKeyOptions, RecoveryKeyResult, BoundlessEventName, BoundlessEventHandler } from "./types";
4
- export declare class BoundlessSDK {
5
- private config;
6
- private kit;
7
- private _walletAddress;
8
- private authClient;
9
- constructor(config: BoundlessSdkConfig);
10
- /**
11
- * Access the underlying SmartAccountKit instance for advanced usage.
12
- */
13
- get smartAccountKit(): SmartAccountKit;
14
- /**
15
- * Connect to an existing passkey wallet.
16
- * If prompt is true, forces the browser passkey selection UI.
17
- * Does NOT deploy a new wallet.
18
- */
19
- connect(options?: ConnectOptions): Promise<ConnectResult | null>;
20
- /**
21
- * Create a new wallet + credential for a user.
22
- * Triggers browser passkey prompt.
23
- * Links to the active Better-Auth session.
24
- */
25
- register(userName: string): Promise<ConnectResult>;
26
- /**
27
- * Link a Stellar wallet address to the currently authenticated user session.
28
- */
29
- private linkToSession;
30
- /**
31
- * Sign and submit a transaction.
32
- * Delegates to SmartAccountKit (which handles relayer if configured).
33
- */
34
- signAndSubmit(transaction: AssembledTransaction<any>): Promise<SignAndSubmitResult>;
35
- /**
36
- * Fetch the balance of the connected wallet (or any specific address).
37
- * By default, fetches native XLM balance.
38
- * If assetCode (and issuer) is provided, fetches that asset's balance.
39
- * If assetCode starts with 'C', it is treated as a contract ID.
40
- */
41
- getBalance(address: string, assetCode?: string, assetIssuer?: string): Promise<string>;
42
- /**
43
- * Transfer funds (XLM or Token).
44
- * Automatically resolves Asset-to-Contract if needed.
45
- */
46
- transfer(to: string, amount: string | number, assetCode?: string, assetIssuer?: string): Promise<SignAndSubmitResult>;
47
- /**
48
- * Disconnect the wallet (clear local session).
49
- * Does NOT sign out of Better-Auth.
50
- */
51
- disconnect(): Promise<void>;
52
- /**
53
- * Get the connected wallet address synchronously.
54
- */
55
- getWalletAddress(): string | null;
56
- /**
57
- * Add a recovery key (new passkey) to the existing account.
58
- */
59
- addRecoveryKey(options: AddRecoveryKeyOptions): Promise<RecoveryKeyResult>;
60
- /**
61
- * Remove a credential by ID.
62
- */
63
- removeCredential(credentialId: string): Promise<void>;
64
- /**
65
- * Subscribe to events.
66
- */
67
- onEvent(event: BoundlessEventName, handler: BoundlessEventHandler): () => void;
68
- }
69
- //# sourceMappingURL=boundless-sdk.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"boundless-sdk.d.ts","sourceRoot":"","sources":["../src/boundless-sdk.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAIhB,MAAM,mBAAmB,CAAC;AAW3B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAM9D,OAAO,KAAK,EACV,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,qBAAqB,EACtB,MAAM,SAAS,CAAC;AAKjB,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,GAAG,CAAkB;IAC7B,OAAO,CAAC,cAAc,CAAuB;IAE7C,OAAO,CAAC,UAAU,CAAM;gBAEZ,MAAM,EAAE,kBAAkB;IAmCtC;;OAEG;IACH,IAAI,eAAe,IAAI,eAAe,CAErC;IAED;;;;OAIG;IACG,OAAO,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAsCtE;;;;OAIG;IACG,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAmBxD;;OAEG;YACW,aAAa;IAkC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