@subly_fi/pay 0.1.1 → 0.2.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/dist/deposit.js +18 -18
- package/dist/mcp-server.js +490 -647
- package/dist/pay.js +22 -22
- package/dist/withdraw.js +17 -17
- package/package.json +4 -2
package/dist/deposit.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
//
|
|
1
|
+
// src/client/agent-wallet-signer.ts
|
|
2
2
|
import { signBytes } from "@solana/kit";
|
|
3
3
|
import bs584 from "bs58";
|
|
4
4
|
|
|
5
|
-
//
|
|
5
|
+
// src/solana/tx.ts
|
|
6
6
|
import bs58 from "bs58";
|
|
7
7
|
import {
|
|
8
8
|
appendTransactionMessageInstructions,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
setTransactionMessageLifetimeUsingBlockhash
|
|
18
18
|
} from "@solana/kit";
|
|
19
19
|
|
|
20
|
-
//
|
|
20
|
+
// src/lib/hash.ts
|
|
21
21
|
import { createHash } from "node:crypto";
|
|
22
22
|
function sha256TaggedHex(data) {
|
|
23
23
|
return `sha256-${createHash("sha256").update(data).digest("hex")}`;
|
|
@@ -42,7 +42,7 @@ function hashStableJson(value) {
|
|
|
42
42
|
return sha256TaggedHex(stableStringify(value));
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
//
|
|
45
|
+
// src/solana/tx.ts
|
|
46
46
|
function decodeSerializedTransaction(serializedBase64) {
|
|
47
47
|
return getTransactionDecoder().decode(Buffer.from(serializedBase64, "base64"));
|
|
48
48
|
}
|
|
@@ -62,11 +62,11 @@ function signatureBase58ForSigner(transaction, signer2) {
|
|
|
62
62
|
return bs58.encode(signature);
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
//
|
|
65
|
+
// src/client/transaction-intent-validator.ts
|
|
66
66
|
import bs583 from "bs58";
|
|
67
67
|
import { getCompiledTransactionMessageDecoder } from "@solana/kit";
|
|
68
68
|
|
|
69
|
-
//
|
|
69
|
+
// src/config/constants.ts
|
|
70
70
|
var PAYMENT_SCHEME = "subly-yield-exact";
|
|
71
71
|
var SOLANA_MAINNET_NETWORK = "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
|
|
72
72
|
var SPL_TOKEN_PROGRAM_ID = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
@@ -82,7 +82,7 @@ var SUBLY_VAULT = {
|
|
|
82
82
|
};
|
|
83
83
|
var USDC_DECIMALS = 6;
|
|
84
84
|
|
|
85
|
-
//
|
|
85
|
+
// src/domain/request-binding.ts
|
|
86
86
|
function computeRequestBindingHash(fields) {
|
|
87
87
|
return hashStableJson({
|
|
88
88
|
sellerRequestId: fields.sellerRequestId,
|
|
@@ -97,7 +97,7 @@ function computeRequestBindingHash(fields) {
|
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
//
|
|
100
|
+
// src/lib/associated-token-account.ts
|
|
101
101
|
import { createHash as createHash2 } from "node:crypto";
|
|
102
102
|
import bs582 from "bs58";
|
|
103
103
|
var PDA_MARKER = Buffer.from("ProgramDerivedAddress", "utf8");
|
|
@@ -189,7 +189,7 @@ function modPow(base, exponent, modulus) {
|
|
|
189
189
|
return result;
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
-
//
|
|
192
|
+
// src/client/transaction-intent-validator.ts
|
|
193
193
|
var COMPUTE_BUDGET_PROGRAM_ID = "ComputeBudget111111111111111111111111111111";
|
|
194
194
|
var SYSTEM_PROGRAM_ID = "11111111111111111111111111111111";
|
|
195
195
|
var ASSOCIATED_TOKEN_PROGRAM_ID2 = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
@@ -875,7 +875,7 @@ function readShortVec(bytes, startOffset) {
|
|
|
875
875
|
return null;
|
|
876
876
|
}
|
|
877
877
|
|
|
878
|
-
//
|
|
878
|
+
// src/client/agent-wallet-signer.ts
|
|
879
879
|
var LocalKeypairAgentWalletSigner = class {
|
|
880
880
|
validationMode = "structured_intent_transaction";
|
|
881
881
|
keyPairSigner;
|
|
@@ -945,7 +945,7 @@ var LocalKeypairAgentWalletSigner = class {
|
|
|
945
945
|
}
|
|
946
946
|
};
|
|
947
947
|
|
|
948
|
-
//
|
|
948
|
+
// src/api/wallet-auth.ts
|
|
949
949
|
import { createHash as createHash3 } from "node:crypto";
|
|
950
950
|
import bs585 from "bs58";
|
|
951
951
|
import nacl from "tweetnacl";
|
|
@@ -963,7 +963,7 @@ function walletAuthMessage(params) {
|
|
|
963
963
|
);
|
|
964
964
|
}
|
|
965
965
|
|
|
966
|
-
//
|
|
966
|
+
// src/client/wallet-auth-headers.ts
|
|
967
967
|
async function walletAuthHeaders(params) {
|
|
968
968
|
const signedAtMs = String(Date.now());
|
|
969
969
|
const message = walletAuthMessage({
|
|
@@ -979,7 +979,7 @@ async function walletAuthHeaders(params) {
|
|
|
979
979
|
};
|
|
980
980
|
}
|
|
981
981
|
|
|
982
|
-
//
|
|
982
|
+
// src/client/onboarding.ts
|
|
983
983
|
var SELF_SERVE_POLICY_ID = "self-serve";
|
|
984
984
|
var OnboardingError = class extends Error {
|
|
985
985
|
constructor(step, message, detail = null) {
|
|
@@ -1036,7 +1036,7 @@ async function ensureWalletOnboarded(params) {
|
|
|
1036
1036
|
await post("sync", `/v1/wallets/${wallet}/sync`, { source: "chain" });
|
|
1037
1037
|
}
|
|
1038
1038
|
|
|
1039
|
-
//
|
|
1039
|
+
// src/client/lookup-tables.ts
|
|
1040
1040
|
import { fetchAllMaybeAddressLookupTable } from "@solana-program/address-lookup-table";
|
|
1041
1041
|
import { address, getCompiledTransactionMessageDecoder as getCompiledTransactionMessageDecoder2 } from "@solana/kit";
|
|
1042
1042
|
function lookupTableAddressesForTransaction(serializedTransaction) {
|
|
@@ -1076,7 +1076,7 @@ async function fetchLookupTablesForTransaction(rpc2, serializedTransaction) {
|
|
|
1076
1076
|
return result;
|
|
1077
1077
|
}
|
|
1078
1078
|
|
|
1079
|
-
//
|
|
1079
|
+
// src/solana/keys.ts
|
|
1080
1080
|
import { readFileSync } from "node:fs";
|
|
1081
1081
|
import bs586 from "bs58";
|
|
1082
1082
|
import {
|
|
@@ -1101,13 +1101,13 @@ async function loadKeyPairSigner(params) {
|
|
|
1101
1101
|
throw new Error(`${label} keypair is not configured`);
|
|
1102
1102
|
}
|
|
1103
1103
|
|
|
1104
|
-
//
|
|
1104
|
+
// src/solana/rpc.ts
|
|
1105
1105
|
import { createSolanaRpc } from "@solana/kit";
|
|
1106
1106
|
function createRpc(url) {
|
|
1107
1107
|
return createSolanaRpc(url);
|
|
1108
1108
|
}
|
|
1109
1109
|
|
|
1110
|
-
//
|
|
1110
|
+
// demo/shared.ts
|
|
1111
1111
|
function fail(message) {
|
|
1112
1112
|
console.error(message);
|
|
1113
1113
|
process.exit(1);
|
|
@@ -1119,7 +1119,7 @@ function formatRawUsdc(raw) {
|
|
|
1119
1119
|
return `${whole}.${fraction}`;
|
|
1120
1120
|
}
|
|
1121
1121
|
|
|
1122
|
-
//
|
|
1122
|
+
// demo/deposit.ts
|
|
1123
1123
|
var facilitatorBaseUrl = process.env.SUBLY_FACILITATOR_URL ?? "https://api.demo.sublyfi.com";
|
|
1124
1124
|
var amountRawUsdc = process.argv[2];
|
|
1125
1125
|
if (amountRawUsdc === void 0 || !/^[1-9]\d*$/.test(amountRawUsdc)) {
|