@dexterai/vault 0.4.2 → 0.6.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.
- package/README.md +62 -16
- package/dist/connect/index.cjs +455 -0
- package/dist/connect/index.d.cts +145 -0
- package/dist/connect/index.d.ts +145 -0
- package/dist/connect/index.js +419 -0
- package/dist/constants/index.cjs +13 -1
- package/dist/constants/index.d.cts +11 -1
- package/dist/constants/index.d.ts +11 -1
- package/dist/constants/index.js +12 -1
- package/dist/counterfactual.cjs +12 -1
- package/dist/counterfactual.js +12 -1
- package/dist/factoring/index.cjs +246 -0
- package/dist/factoring/index.d.cts +79 -0
- package/dist/factoring/index.d.ts +79 -0
- package/dist/factoring/index.js +220 -0
- package/dist/idl/dexter_vault.json +976 -1
- package/dist/index.cjs +12 -1
- package/dist/index.js +12 -1
- package/dist/instructions/index.cjs +249 -4400
- package/dist/instructions/index.d.cts +172 -1
- package/dist/instructions/index.d.ts +172 -1
- package/dist/instructions/index.js +235 -4396
- package/dist/kit/index.cjs +67 -0
- package/dist/kit/index.d.cts +13 -0
- package/dist/kit/index.d.ts +13 -0
- package/dist/kit/index.js +41 -0
- package/dist/messages/index.cjs +11 -1
- package/dist/messages/index.js +11 -1
- package/dist/precompile/index.cjs +11 -1
- package/dist/precompile/index.js +11 -1
- package/dist/tab/index.cjs +640 -0
- package/dist/tab/index.d.cts +145 -0
- package/dist/tab/index.d.ts +145 -0
- package/dist/tab/index.js +631 -0
- package/package.json +23 -1
|
@@ -0,0 +1,67 @@
|
|
|
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/kit/index.ts
|
|
21
|
+
var kit_exports = {};
|
|
22
|
+
__export(kit_exports, {
|
|
23
|
+
getRpc: () => getRpc,
|
|
24
|
+
kitInstructionsToWeb3: () => kitInstructionsToWeb3
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(kit_exports);
|
|
27
|
+
var import_web3 = require("@solana/web3.js");
|
|
28
|
+
var import_kit = require("@solana/kit");
|
|
29
|
+
function kitInstructionsToWeb3(kitInstructions) {
|
|
30
|
+
return kitInstructions.map((ix) => {
|
|
31
|
+
const accounts = (ix.accounts ?? []).map((acc) => {
|
|
32
|
+
const role = acc.role;
|
|
33
|
+
const hasBooleanShape = typeof acc.signer === "boolean" || typeof acc.writable === "boolean";
|
|
34
|
+
let isSigner = false;
|
|
35
|
+
let isWritable = false;
|
|
36
|
+
if (hasBooleanShape) {
|
|
37
|
+
isSigner = Boolean(acc.signer);
|
|
38
|
+
isWritable = Boolean(acc.writable);
|
|
39
|
+
} else if (typeof role === "number") {
|
|
40
|
+
isSigner = role >= 2;
|
|
41
|
+
isWritable = role % 2 === 1;
|
|
42
|
+
} else if (typeof role === "string") {
|
|
43
|
+
const r = role.toLowerCase();
|
|
44
|
+
isSigner = r.endsWith("signer");
|
|
45
|
+
isWritable = r.startsWith("writable");
|
|
46
|
+
}
|
|
47
|
+
const addressSource = acc.address ?? acc.publicKey;
|
|
48
|
+
const pubkey = addressSource instanceof import_web3.PublicKey ? addressSource : typeof addressSource === "string" ? new import_web3.PublicKey(addressSource) : new import_web3.PublicKey(String(addressSource));
|
|
49
|
+
return { pubkey, isSigner, isWritable };
|
|
50
|
+
});
|
|
51
|
+
return new import_web3.TransactionInstruction({
|
|
52
|
+
programId: new import_web3.PublicKey(ix.programAddress ?? ix.programId),
|
|
53
|
+
keys: accounts,
|
|
54
|
+
data: Buffer.from(ix.data ?? [])
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function getRpc(connection) {
|
|
59
|
+
const endpoint = connection._rpcEndpoint ?? connection.rpcEndpoint;
|
|
60
|
+
if (!endpoint) throw new Error("kit: cannot extract RPC endpoint from connection");
|
|
61
|
+
return (0, import_kit.createSolanaRpc)(endpoint);
|
|
62
|
+
}
|
|
63
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
64
|
+
0 && (module.exports = {
|
|
65
|
+
getRpc,
|
|
66
|
+
kitInstructionsToWeb3
|
|
67
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Connection, TransactionInstruction } from '@solana/web3.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Kit v2 → Web3.js v1 instruction converter + RPC extractor.
|
|
5
|
+
* The single home for the Swig-kit↔web3 bridge. Both ./factoring and ./tab
|
|
6
|
+
* (and the program test suites) import from here — one copy, no drift.
|
|
7
|
+
* Originally duplicated across 8 files; consolidated 2026-06-07.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
declare function kitInstructionsToWeb3(kitInstructions: any[]): TransactionInstruction[];
|
|
11
|
+
declare function getRpc(connection: Connection): any;
|
|
12
|
+
|
|
13
|
+
export { getRpc, kitInstructionsToWeb3 };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Connection, TransactionInstruction } from '@solana/web3.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Kit v2 → Web3.js v1 instruction converter + RPC extractor.
|
|
5
|
+
* The single home for the Swig-kit↔web3 bridge. Both ./factoring and ./tab
|
|
6
|
+
* (and the program test suites) import from here — one copy, no drift.
|
|
7
|
+
* Originally duplicated across 8 files; consolidated 2026-06-07.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
declare function kitInstructionsToWeb3(kitInstructions: any[]): TransactionInstruction[];
|
|
11
|
+
declare function getRpc(connection: Connection): any;
|
|
12
|
+
|
|
13
|
+
export { getRpc, kitInstructionsToWeb3 };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// src/kit/index.ts
|
|
2
|
+
import { PublicKey, TransactionInstruction } from "@solana/web3.js";
|
|
3
|
+
import { createSolanaRpc } from "@solana/kit";
|
|
4
|
+
function kitInstructionsToWeb3(kitInstructions) {
|
|
5
|
+
return kitInstructions.map((ix) => {
|
|
6
|
+
const accounts = (ix.accounts ?? []).map((acc) => {
|
|
7
|
+
const role = acc.role;
|
|
8
|
+
const hasBooleanShape = typeof acc.signer === "boolean" || typeof acc.writable === "boolean";
|
|
9
|
+
let isSigner = false;
|
|
10
|
+
let isWritable = false;
|
|
11
|
+
if (hasBooleanShape) {
|
|
12
|
+
isSigner = Boolean(acc.signer);
|
|
13
|
+
isWritable = Boolean(acc.writable);
|
|
14
|
+
} else if (typeof role === "number") {
|
|
15
|
+
isSigner = role >= 2;
|
|
16
|
+
isWritable = role % 2 === 1;
|
|
17
|
+
} else if (typeof role === "string") {
|
|
18
|
+
const r = role.toLowerCase();
|
|
19
|
+
isSigner = r.endsWith("signer");
|
|
20
|
+
isWritable = r.startsWith("writable");
|
|
21
|
+
}
|
|
22
|
+
const addressSource = acc.address ?? acc.publicKey;
|
|
23
|
+
const pubkey = addressSource instanceof PublicKey ? addressSource : typeof addressSource === "string" ? new PublicKey(addressSource) : new PublicKey(String(addressSource));
|
|
24
|
+
return { pubkey, isSigner, isWritable };
|
|
25
|
+
});
|
|
26
|
+
return new TransactionInstruction({
|
|
27
|
+
programId: new PublicKey(ix.programAddress ?? ix.programId),
|
|
28
|
+
keys: accounts,
|
|
29
|
+
data: Buffer.from(ix.data ?? [])
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function getRpc(connection) {
|
|
34
|
+
const endpoint = connection._rpcEndpoint ?? connection.rpcEndpoint;
|
|
35
|
+
if (!endpoint) throw new Error("kit: cannot extract RPC endpoint from connection");
|
|
36
|
+
return createSolanaRpc(endpoint);
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
getRpc,
|
|
40
|
+
kitInstructionsToWeb3
|
|
41
|
+
};
|
package/dist/messages/index.cjs
CHANGED
|
@@ -46,6 +46,7 @@ var INSTRUCTIONS_SYSVAR_ID = new import_web3.PublicKey(
|
|
|
46
46
|
"Sysvar1nstructions1111111111111111111111111"
|
|
47
47
|
);
|
|
48
48
|
var VAULT_SEED_PREFIX = Buffer.from("vault");
|
|
49
|
+
var LOCKED_CLAIM_SEED = Buffer.from("locked-claim");
|
|
49
50
|
var DISCRIMINATORS = Object.freeze({
|
|
50
51
|
initialize_vault: Uint8Array.from([48, 191, 163, 44, 71, 129, 63, 164]),
|
|
51
52
|
set_swig: Uint8Array.from([253, 229, 89, 206, 192, 118, 137, 165]),
|
|
@@ -58,7 +59,16 @@ var DISCRIMINATORS = Object.freeze({
|
|
|
58
59
|
prove_passkey: Uint8Array.from([35, 175, 41, 143, 201, 118, 49, 184]),
|
|
59
60
|
settle_tab_voucher: Uint8Array.from([173, 22, 98, 31, 110, 129, 59, 161]),
|
|
60
61
|
register_session_key: Uint8Array.from([69, 94, 60, 44, 49, 199, 183, 233]),
|
|
61
|
-
revoke_session_key: Uint8Array.from([81, 192, 32, 110, 104, 116, 144, 151])
|
|
62
|
+
revoke_session_key: Uint8Array.from([81, 192, 32, 110, 104, 116, 144, 151]),
|
|
63
|
+
lock_voucher: Uint8Array.from([91, 138, 5, 227, 119, 239, 48, 254]),
|
|
64
|
+
settle_locked_voucher: Uint8Array.from([44, 80, 216, 43, 247, 253, 101, 45]),
|
|
65
|
+
transfer_lock_ownership: Uint8Array.from([193, 13, 131, 134, 95, 25, 229, 157]),
|
|
66
|
+
recover_abandoned_lock: Uint8Array.from([169, 213, 107, 64, 229, 49, 43, 234]),
|
|
67
|
+
open_standby: Uint8Array.from([234, 184, 232, 135, 246, 191, 90, 250]),
|
|
68
|
+
draw_credit: Uint8Array.from([20, 84, 47, 211, 78, 117, 195, 210]),
|
|
69
|
+
repay_credit: Uint8Array.from([38, 113, 240, 182, 109, 179, 154, 245]),
|
|
70
|
+
seize_collateral: Uint8Array.from([40, 250, 7, 243, 168, 184, 116, 154]),
|
|
71
|
+
migrate_v4_to_v5: Uint8Array.from([226, 105, 140, 184, 101, 39, 235, 116])
|
|
62
72
|
});
|
|
63
73
|
var OTS_SESSION_REGISTER_V1_DOMAIN = (() => {
|
|
64
74
|
const buf = new Uint8Array(32);
|
package/dist/messages/index.js
CHANGED
|
@@ -16,6 +16,7 @@ var INSTRUCTIONS_SYSVAR_ID = new PublicKey(
|
|
|
16
16
|
"Sysvar1nstructions1111111111111111111111111"
|
|
17
17
|
);
|
|
18
18
|
var VAULT_SEED_PREFIX = Buffer.from("vault");
|
|
19
|
+
var LOCKED_CLAIM_SEED = Buffer.from("locked-claim");
|
|
19
20
|
var DISCRIMINATORS = Object.freeze({
|
|
20
21
|
initialize_vault: Uint8Array.from([48, 191, 163, 44, 71, 129, 63, 164]),
|
|
21
22
|
set_swig: Uint8Array.from([253, 229, 89, 206, 192, 118, 137, 165]),
|
|
@@ -28,7 +29,16 @@ var DISCRIMINATORS = Object.freeze({
|
|
|
28
29
|
prove_passkey: Uint8Array.from([35, 175, 41, 143, 201, 118, 49, 184]),
|
|
29
30
|
settle_tab_voucher: Uint8Array.from([173, 22, 98, 31, 110, 129, 59, 161]),
|
|
30
31
|
register_session_key: Uint8Array.from([69, 94, 60, 44, 49, 199, 183, 233]),
|
|
31
|
-
revoke_session_key: Uint8Array.from([81, 192, 32, 110, 104, 116, 144, 151])
|
|
32
|
+
revoke_session_key: Uint8Array.from([81, 192, 32, 110, 104, 116, 144, 151]),
|
|
33
|
+
lock_voucher: Uint8Array.from([91, 138, 5, 227, 119, 239, 48, 254]),
|
|
34
|
+
settle_locked_voucher: Uint8Array.from([44, 80, 216, 43, 247, 253, 101, 45]),
|
|
35
|
+
transfer_lock_ownership: Uint8Array.from([193, 13, 131, 134, 95, 25, 229, 157]),
|
|
36
|
+
recover_abandoned_lock: Uint8Array.from([169, 213, 107, 64, 229, 49, 43, 234]),
|
|
37
|
+
open_standby: Uint8Array.from([234, 184, 232, 135, 246, 191, 90, 250]),
|
|
38
|
+
draw_credit: Uint8Array.from([20, 84, 47, 211, 78, 117, 195, 210]),
|
|
39
|
+
repay_credit: Uint8Array.from([38, 113, 240, 182, 109, 179, 154, 245]),
|
|
40
|
+
seize_collateral: Uint8Array.from([40, 250, 7, 243, 168, 184, 116, 154]),
|
|
41
|
+
migrate_v4_to_v5: Uint8Array.from([226, 105, 140, 184, 101, 39, 235, 116])
|
|
32
42
|
});
|
|
33
43
|
var OTS_SESSION_REGISTER_V1_DOMAIN = (() => {
|
|
34
44
|
const buf = new Uint8Array(32);
|
|
@@ -61,6 +61,7 @@ var INSTRUCTIONS_SYSVAR_ID = new import_web3.PublicKey(
|
|
|
61
61
|
"Sysvar1nstructions1111111111111111111111111"
|
|
62
62
|
);
|
|
63
63
|
var VAULT_SEED_PREFIX = Buffer.from("vault");
|
|
64
|
+
var LOCKED_CLAIM_SEED = Buffer.from("locked-claim");
|
|
64
65
|
var DISCRIMINATORS = Object.freeze({
|
|
65
66
|
initialize_vault: Uint8Array.from([48, 191, 163, 44, 71, 129, 63, 164]),
|
|
66
67
|
set_swig: Uint8Array.from([253, 229, 89, 206, 192, 118, 137, 165]),
|
|
@@ -73,7 +74,16 @@ var DISCRIMINATORS = Object.freeze({
|
|
|
73
74
|
prove_passkey: Uint8Array.from([35, 175, 41, 143, 201, 118, 49, 184]),
|
|
74
75
|
settle_tab_voucher: Uint8Array.from([173, 22, 98, 31, 110, 129, 59, 161]),
|
|
75
76
|
register_session_key: Uint8Array.from([69, 94, 60, 44, 49, 199, 183, 233]),
|
|
76
|
-
revoke_session_key: Uint8Array.from([81, 192, 32, 110, 104, 116, 144, 151])
|
|
77
|
+
revoke_session_key: Uint8Array.from([81, 192, 32, 110, 104, 116, 144, 151]),
|
|
78
|
+
lock_voucher: Uint8Array.from([91, 138, 5, 227, 119, 239, 48, 254]),
|
|
79
|
+
settle_locked_voucher: Uint8Array.from([44, 80, 216, 43, 247, 253, 101, 45]),
|
|
80
|
+
transfer_lock_ownership: Uint8Array.from([193, 13, 131, 134, 95, 25, 229, 157]),
|
|
81
|
+
recover_abandoned_lock: Uint8Array.from([169, 213, 107, 64, 229, 49, 43, 234]),
|
|
82
|
+
open_standby: Uint8Array.from([234, 184, 232, 135, 246, 191, 90, 250]),
|
|
83
|
+
draw_credit: Uint8Array.from([20, 84, 47, 211, 78, 117, 195, 210]),
|
|
84
|
+
repay_credit: Uint8Array.from([38, 113, 240, 182, 109, 179, 154, 245]),
|
|
85
|
+
seize_collateral: Uint8Array.from([40, 250, 7, 243, 168, 184, 116, 154]),
|
|
86
|
+
migrate_v4_to_v5: Uint8Array.from([226, 105, 140, 184, 101, 39, 235, 116])
|
|
77
87
|
});
|
|
78
88
|
var OTS_SESSION_REGISTER_V1_DOMAIN = (() => {
|
|
79
89
|
const buf = new Uint8Array(32);
|
package/dist/precompile/index.js
CHANGED
|
@@ -19,6 +19,7 @@ var INSTRUCTIONS_SYSVAR_ID = new PublicKey(
|
|
|
19
19
|
"Sysvar1nstructions1111111111111111111111111"
|
|
20
20
|
);
|
|
21
21
|
var VAULT_SEED_PREFIX = Buffer.from("vault");
|
|
22
|
+
var LOCKED_CLAIM_SEED = Buffer.from("locked-claim");
|
|
22
23
|
var DISCRIMINATORS = Object.freeze({
|
|
23
24
|
initialize_vault: Uint8Array.from([48, 191, 163, 44, 71, 129, 63, 164]),
|
|
24
25
|
set_swig: Uint8Array.from([253, 229, 89, 206, 192, 118, 137, 165]),
|
|
@@ -31,7 +32,16 @@ var DISCRIMINATORS = Object.freeze({
|
|
|
31
32
|
prove_passkey: Uint8Array.from([35, 175, 41, 143, 201, 118, 49, 184]),
|
|
32
33
|
settle_tab_voucher: Uint8Array.from([173, 22, 98, 31, 110, 129, 59, 161]),
|
|
33
34
|
register_session_key: Uint8Array.from([69, 94, 60, 44, 49, 199, 183, 233]),
|
|
34
|
-
revoke_session_key: Uint8Array.from([81, 192, 32, 110, 104, 116, 144, 151])
|
|
35
|
+
revoke_session_key: Uint8Array.from([81, 192, 32, 110, 104, 116, 144, 151]),
|
|
36
|
+
lock_voucher: Uint8Array.from([91, 138, 5, 227, 119, 239, 48, 254]),
|
|
37
|
+
settle_locked_voucher: Uint8Array.from([44, 80, 216, 43, 247, 253, 101, 45]),
|
|
38
|
+
transfer_lock_ownership: Uint8Array.from([193, 13, 131, 134, 95, 25, 229, 157]),
|
|
39
|
+
recover_abandoned_lock: Uint8Array.from([169, 213, 107, 64, 229, 49, 43, 234]),
|
|
40
|
+
open_standby: Uint8Array.from([234, 184, 232, 135, 246, 191, 90, 250]),
|
|
41
|
+
draw_credit: Uint8Array.from([20, 84, 47, 211, 78, 117, 195, 210]),
|
|
42
|
+
repay_credit: Uint8Array.from([38, 113, 240, 182, 109, 179, 154, 245]),
|
|
43
|
+
seize_collateral: Uint8Array.from([40, 250, 7, 243, 168, 184, 116, 154]),
|
|
44
|
+
migrate_v4_to_v5: Uint8Array.from([226, 105, 140, 184, 101, 39, 235, 116])
|
|
35
45
|
});
|
|
36
46
|
var OTS_SESSION_REGISTER_V1_DOMAIN = (() => {
|
|
37
47
|
const buf = new Uint8Array(32);
|