@account-kit/signer 4.26.0 → 4.28.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/esm/base.d.ts +4 -4
- package/dist/esm/base.js +2 -2
- package/dist/esm/base.js.map +1 -1
- package/dist/esm/client/base.d.ts +49 -43
- package/dist/esm/client/base.js +166 -0
- package/dist/esm/client/base.js.map +1 -1
- package/dist/esm/client/index.d.ts +2 -50
- package/dist/esm/client/index.js +1 -162
- package/dist/esm/client/index.js.map +1 -1
- package/dist/esm/client/types.d.ts +4 -7
- package/dist/esm/client/types.js.map +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/solanaSigner.d.ts +37 -4
- package/dist/esm/solanaSigner.js +107 -6
- package/dist/esm/solanaSigner.js.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/types/base.d.ts +4 -4
- package/dist/types/base.d.ts.map +1 -1
- package/dist/types/client/base.d.ts +49 -43
- package/dist/types/client/base.d.ts.map +1 -1
- package/dist/types/client/index.d.ts +2 -50
- package/dist/types/client/index.d.ts.map +1 -1
- package/dist/types/client/types.d.ts +4 -7
- package/dist/types/client/types.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/solanaSigner.d.ts +37 -4
- package/dist/types/solanaSigner.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +6 -4
- package/src/base.ts +5 -5
- package/src/client/base.ts +171 -49
- package/src/client/index.ts +1 -177
- package/src/client/types.ts +4 -7
- package/src/index.ts +1 -0
- package/src/solanaSigner.ts +155 -8
- package/src/version.ts +1 -1
package/dist/esm/solanaSigner.js
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
import { PublicKey, Transaction, } from "@solana/web3.js";
|
|
1
|
+
import { Connection, PublicKey, Transaction, TransactionInstruction, TransactionMessage, VersionedTransaction, } from "@solana/web3.js";
|
|
2
2
|
import { size, slice, toBytes, toHex } from "viem";
|
|
3
3
|
import { NotAuthenticatedError } from "./errors.js";
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* The SolanaSigner class is used to sign transactions and messages for the Solana blockchain.
|
|
6
|
+
* It provides methods to add signatures to transactions and sign messages.
|
|
7
|
+
*/
|
|
5
8
|
export class SolanaSigner {
|
|
9
|
+
/**
|
|
10
|
+
* Constructor for the SolanaSigner class which is a wrapper around the alchemy client, and is more focused on the solana web3
|
|
11
|
+
*
|
|
12
|
+
* @param {object} client This is the client that will be used to sign the transaction, and we are just having functions on top of it.
|
|
13
|
+
*/
|
|
6
14
|
constructor(client) {
|
|
7
15
|
Object.defineProperty(this, "alchemyClient", {
|
|
8
16
|
enumerable: true,
|
|
@@ -22,7 +30,13 @@ export class SolanaSigner {
|
|
|
22
30
|
// TODO: also throw here
|
|
23
31
|
this.address = client.getUser().solanaAddress;
|
|
24
32
|
}
|
|
25
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Adds a signature of the client user to a transaction
|
|
35
|
+
*
|
|
36
|
+
* @param {Transaction | VersionedTransaction} transaction - The transaction to add the signature to
|
|
37
|
+
* @returns {Promise<Transaction | VersionedTransaction >} The transaction with the signature added
|
|
38
|
+
*/
|
|
39
|
+
async addSignature(transaction) {
|
|
26
40
|
const user = this.alchemyClient.getUser();
|
|
27
41
|
if (!user) {
|
|
28
42
|
throw new NotAuthenticatedError();
|
|
@@ -31,11 +45,17 @@ export class SolanaSigner {
|
|
|
31
45
|
throw new Error("no solana address");
|
|
32
46
|
}
|
|
33
47
|
const fromKey = new PublicKey(user.solanaAddress);
|
|
34
|
-
const messageToSign = this.getMessageToSign(
|
|
48
|
+
const messageToSign = this.getMessageToSign(transaction);
|
|
35
49
|
const signature = await this.alchemyClient.signRawMessage(messageToSign, "SOLANA");
|
|
36
|
-
|
|
37
|
-
return
|
|
50
|
+
transaction.addSignature(fromKey, Buffer.from(toBytes(this.formatSignatureForSolana(signature))));
|
|
51
|
+
return transaction;
|
|
38
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Signs a message
|
|
55
|
+
*
|
|
56
|
+
* @param {Uint8Array} message - The message to sign
|
|
57
|
+
* @returns {Promise<ByteArray>} The signature of the message
|
|
58
|
+
*/
|
|
39
59
|
async signMessage(message) {
|
|
40
60
|
const user = this.alchemyClient.getUser();
|
|
41
61
|
if (!user) {
|
|
@@ -48,6 +68,84 @@ export class SolanaSigner {
|
|
|
48
68
|
const signature = await this.alchemyClient.signRawMessage(messageToSign, "SOLANA");
|
|
49
69
|
return toBytes(this.formatSignatureForSolana(signature));
|
|
50
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Creates a transfer transaction. Used for the SolanaCard example.
|
|
73
|
+
*
|
|
74
|
+
* @param {TransactionInstruction[]} instructions - The instructions to add to the transaction
|
|
75
|
+
* @param {Connection} connection - The connection to use for the transaction
|
|
76
|
+
* @param {"versioned" | "legacy"} [version] - The version of the transaction
|
|
77
|
+
* @returns {Promise<Transaction | VersionedTransaction>} The transfer transaction
|
|
78
|
+
*/
|
|
79
|
+
async createTransfer(instructions, connection, version) {
|
|
80
|
+
const blockhash = (await connection.getLatestBlockhash()).blockhash;
|
|
81
|
+
let transferTransaction;
|
|
82
|
+
if (version === "legacy") {
|
|
83
|
+
// Legacy transaction
|
|
84
|
+
transferTransaction = instructions.reduce((tx, instruction) => tx.add(instruction), new Transaction());
|
|
85
|
+
// Get a recent block hash
|
|
86
|
+
transferTransaction.recentBlockhash = blockhash;
|
|
87
|
+
// Set the signer
|
|
88
|
+
transferTransaction.feePayer = new PublicKey(this.address);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
// VersionedTransaction
|
|
92
|
+
const txMessage = new TransactionMessage({
|
|
93
|
+
payerKey: new PublicKey(this.address),
|
|
94
|
+
recentBlockhash: blockhash,
|
|
95
|
+
instructions,
|
|
96
|
+
});
|
|
97
|
+
const versionedTxMessage = txMessage.compileToV0Message();
|
|
98
|
+
transferTransaction = new VersionedTransaction(versionedTxMessage);
|
|
99
|
+
}
|
|
100
|
+
return transferTransaction;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Adds sponsorship to a transaction. Used to have a party like Alchemy pay for the transaction.
|
|
104
|
+
*
|
|
105
|
+
* @param {TransactionInstruction[]} instructions - The instructions to add to the transaction
|
|
106
|
+
* @param {Connection} connection - The connection to use for the transaction
|
|
107
|
+
* @param {string} [policyId] - The policy ID to add sponsorship to
|
|
108
|
+
* @returns {Promise<VersionedTransaction>} The transaction with sponsorship added
|
|
109
|
+
*/
|
|
110
|
+
async addSponsorship(instructions, connection, policyId) {
|
|
111
|
+
const { blockhash } = await connection.getLatestBlockhash({
|
|
112
|
+
commitment: "finalized",
|
|
113
|
+
});
|
|
114
|
+
const message = new TransactionMessage({
|
|
115
|
+
// Right now the backend will rewrite this payer Key to the server's address
|
|
116
|
+
payerKey: new PublicKey(this.address),
|
|
117
|
+
recentBlockhash: blockhash,
|
|
118
|
+
instructions,
|
|
119
|
+
}).compileToV0Message();
|
|
120
|
+
const versionedTransaction = new VersionedTransaction(message);
|
|
121
|
+
const serializedTransaction = Buffer.from(versionedTransaction.serialize()).toString("base64");
|
|
122
|
+
const body = JSON.stringify({
|
|
123
|
+
id: crypto?.randomUUID() ?? Math.floor(Math.random() * 1000000),
|
|
124
|
+
jsonrpc: "2.0",
|
|
125
|
+
method: "alchemy_requestFeePayer",
|
|
126
|
+
params: [
|
|
127
|
+
{
|
|
128
|
+
policyId,
|
|
129
|
+
serializedTransaction,
|
|
130
|
+
},
|
|
131
|
+
],
|
|
132
|
+
});
|
|
133
|
+
const options = {
|
|
134
|
+
method: "POST",
|
|
135
|
+
headers: {
|
|
136
|
+
accept: "application/json",
|
|
137
|
+
"content-type": "application/json",
|
|
138
|
+
},
|
|
139
|
+
body,
|
|
140
|
+
};
|
|
141
|
+
const response = await fetch(
|
|
142
|
+
// TODO: Use the connection??
|
|
143
|
+
connection.rpcEndpoint, options);
|
|
144
|
+
const jsonResponse = await response.json();
|
|
145
|
+
if (!jsonResponse?.result?.serializedTransaction)
|
|
146
|
+
throw new Error(`Response doesn't include the serializedTransaction ${JSON.stringify(jsonResponse)}`);
|
|
147
|
+
return VersionedTransaction.deserialize(decodeBase64(jsonResponse.result.serializedTransaction));
|
|
148
|
+
}
|
|
51
149
|
formatSignatureForSolana(signature) {
|
|
52
150
|
if (size(signature) === 64)
|
|
53
151
|
return signature;
|
|
@@ -64,4 +162,7 @@ export class SolanaSigner {
|
|
|
64
162
|
return toHex(messageToSign);
|
|
65
163
|
}
|
|
66
164
|
}
|
|
165
|
+
function decodeBase64(serializedTransaction) {
|
|
166
|
+
return Buffer.from(serializedTransaction, "base64");
|
|
167
|
+
}
|
|
67
168
|
//# sourceMappingURL=solanaSigner.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solanaSigner.js","sourceRoot":"","sources":["../../src/solanaSigner.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,WAAW,GAEZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAA4B,MAAM,MAAM,CAAC;AAE7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEpD,yGAAyG;AACzG,MAAM,OAAO,YAAY;IAIvB,YAAY,MAAwB;QAH5B;;;;;WAAgC;QACjC;;;;;WAAgB;QAGrB,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC;QAC5B,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;YAAE,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;QAEjE,wBAAwB;QACxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,EAAG,CAAC,aAAc,CAAC;IAClD,CAAC;IAED,KAAK,CAAC,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wBAAwB,CAAC,SAAc;QAC7C,IAAI,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE;YAAE,OAAO,SAAS,CAAC;QAE7C,OAAO,KAAK,CAAC,SAAS,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IACjC,CAAC;IAEO,gBAAgB,CAAC,EAAsC;QAC7D,IAAI,aAAa,CAAC;QAClB,IAAI,EAAE,YAAY,WAAW,EAAE,CAAC;YAC9B,aAAa,GAAG,EAAE,CAAC,gBAAgB,EAAE,CAAC;QACxC,CAAC;aAAM,CAAC;YACN,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;QACtD,CAAC;QACD,OAAO,KAAK,CAAC,aAAa,CAAC,CAAC;IAC9B,CAAC;CACF","sourcesContent":["import {\n PublicKey,\n Transaction,\n type VersionedTransaction,\n} from \"@solana/web3.js\";\nimport { size, slice, toBytes, toHex, type ByteArray, type Hex } from \"viem\";\nimport type { BaseSignerClient } from \"./client/base\";\nimport { NotAuthenticatedError } from \"./errors.js\";\n\n// TODO: I don't want this to be a class so that the flow is closer to how we do this for `toViemAccount`\nexport class SolanaSigner {\n private alchemyClient: BaseSignerClient;\n public address: string;\n\n constructor(client: BaseSignerClient) {\n this.alchemyClient = client;\n if (!client.getUser()) throw new Error(\"Must be authenticated!\");\n\n // TODO: also throw here\n this.address = client.getUser()!.solanaAddress!;\n }\n\n async addSignature(\n tx: Transaction | VersionedTransaction\n ): Promise<Transaction | VersionedTransaction> {\n const user = this.alchemyClient.getUser();\n if (!user) {\n throw new NotAuthenticatedError();\n }\n\n if (!user.solanaAddress) {\n throw new Error(\"no solana address\");\n }\n\n const fromKey = new PublicKey(user.solanaAddress);\n const messageToSign = this.getMessageToSign(tx);\n const signature = await this.alchemyClient.signRawMessage(\n messageToSign,\n \"SOLANA\"\n );\n\n tx.addSignature(\n fromKey,\n Buffer.from(toBytes(this.formatSignatureForSolana(signature)))\n );\n return tx;\n }\n\n async signMessage(message: Uint8Array): Promise<ByteArray> {\n const user = this.alchemyClient.getUser();\n if (!user) {\n throw new NotAuthenticatedError();\n }\n\n if (!user.solanaAddress) {\n throw new Error(\"no solana address\");\n }\n\n const messageToSign = toHex(message);\n const signature = await this.alchemyClient.signRawMessage(\n messageToSign,\n \"SOLANA\"\n );\n\n return toBytes(this.formatSignatureForSolana(signature));\n }\n\n private formatSignatureForSolana(signature: Hex): Hex {\n if (size(signature) === 64) return signature;\n\n return slice(signature, 0, 64);\n }\n\n private getMessageToSign(tx: Transaction | VersionedTransaction): Hex {\n let messageToSign;\n if (tx instanceof Transaction) {\n messageToSign = tx.serializeMessage();\n } else {\n messageToSign = Buffer.from(tx.message.serialize());\n }\n return toHex(messageToSign);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"solanaSigner.js","sourceRoot":"","sources":["../../src/solanaSigner.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EACT,WAAW,EACX,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAA4B,MAAM,MAAM,CAAC;AAE7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEpD;;;GAGG;AACH,MAAM,OAAO,YAAY;IAIvB;;;;OAIG;IACH,YAAY,MAAwB;QAR3B;;;;;WAAgC;QACzB;;;;;WAAgB;QAQ9B,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC;QAC5B,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;YAAE,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;QAEjE,wBAAwB;QACxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,EAAG,CAAC,aAAc,CAAC;IAClD,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,YAAY,CAChB,WAA+C;QAE/C,MAAM,I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AAO,KAAK,CAAC,SAAS,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IACjC,CAAC;IAEO,gBAAgB,CAAC,EAAsC;QAC7D,IAAI,aAAa,CAAC;QAClB,IAAI,EAAE,YAAY,WAAW,EAAE,CAAC;YAC9B,aAAa,GAAG,EAAE,CAAC,gBAAgB,EAAE,CAAC;QACxC,CAAC;aAAM,CAAC;YACN,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;QACtD,CAAC;QACD,OAAO,KAAK,CAAC,aAAa,CAAC,CAAC;IAC9B,CAAC;CACF;AACD,SAAS,YAAY,CAAC,qBAA6B;IACjD,OAAO,MAAM,CAAC,IAAI,CAAC,qBAAqB,EAAE,QAAQ,CAAC,CAAC;AACtD,CAAC","sourcesContent":["import {\n Connection,\n PublicKey,\n Transaction,\n TransactionInstruction,\n TransactionMessage,\n VersionedTransaction,\n} from \"@solana/web3.js\";\nimport { size, slice, toBytes, toHex, type ByteArray, type Hex } from \"viem\";\nimport type { BaseSignerClient } from \"./client/base\";\nimport { NotAuthenticatedError } from \"./errors.js\";\n\n/**\n * The SolanaSigner class is used to sign transactions and messages for the Solana blockchain.\n * It provides methods to add signatures to transactions and sign messages.\n */\nexport class SolanaSigner {\n readonly alchemyClient: BaseSignerClient;\n public readonly address: string;\n\n /**\n * Constructor for the SolanaSigner class which is a wrapper around the alchemy client, and is more focused on the solana web3\n *\n * @param {object} client This is the client that will be used to sign the transaction, and we are just having functions on top of it.\n */\n constructor(client: BaseSignerClient) {\n this.alchemyClient = client;\n if (!client.getUser()) throw new Error(\"Must be authenticated!\");\n\n // TODO: also throw here\n this.address = client.getUser()!.solanaAddress!;\n }\n\n /**\n * Adds a signature of the client user to a transaction\n *\n * @param {Transaction | VersionedTransaction} transaction - The transaction to add the signature to\n * @returns {Promise<Transaction | VersionedTransaction >} The transaction with the signature added\n */\n async addSignature(\n transaction: Transaction | VersionedTransaction\n ): Promise<Transaction | VersionedTransaction> {\n const user = this.alchemyClient.getUser();\n if (!user) {\n throw new NotAuthenticatedError();\n }\n\n if (!user.solanaAddress) {\n throw new Error(\"no solana address\");\n }\n\n const fromKey = new PublicKey(user.solanaAddress);\n const messageToSign = this.getMessageToSign(transaction);\n const signature = await this.alchemyClient.signRawMessage(\n messageToSign,\n \"SOLANA\"\n );\n\n transaction.addSignature(\n fromKey,\n Buffer.from(toBytes(this.formatSignatureForSolana(signature)))\n );\n return transaction;\n }\n\n /**\n * Signs a message\n *\n * @param {Uint8Array} message - The message to sign\n * @returns {Promise<ByteArray>} The signature of the message\n */\n async signMessage(message: Uint8Array): Promise<ByteArray> {\n const user = this.alchemyClient.getUser();\n if (!user) {\n throw new NotAuthenticatedError();\n }\n\n if (!user.solanaAddress) {\n throw new Error(\"no solana address\");\n }\n\n const messageToSign = toHex(message);\n const signature = await this.alchemyClient.signRawMessage(\n messageToSign,\n \"SOLANA\"\n );\n\n return toBytes(this.formatSignatureForSolana(signature));\n }\n\n async createTransfer(\n instructions: TransactionInstruction[],\n connection: Connection,\n version?: \"versioned\"\n ): Promise<VersionedTransaction>;\n async createTransfer(\n instructions: TransactionInstruction[],\n connection: Connection,\n version?: \"legacy\"\n ): Promise<Transaction>;\n async createTransfer(\n instructions: TransactionInstruction[],\n connection: Connection\n ): Promise<VersionedTransaction>;\n\n /**\n * Creates a transfer transaction. Used for the SolanaCard example.\n *\n * @param {TransactionInstruction[]} instructions - The instructions to add to the transaction\n * @param {Connection} connection - The connection to use for the transaction\n * @param {\"versioned\" | \"legacy\"} [version] - The version of the transaction\n * @returns {Promise<Transaction | VersionedTransaction>} The transfer transaction\n */\n async createTransfer(\n instructions: TransactionInstruction[],\n connection: Connection,\n version?: string\n ): Promise<Transaction | VersionedTransaction> {\n const blockhash = (await connection.getLatestBlockhash()).blockhash;\n\n let transferTransaction;\n\n if (version === \"legacy\") {\n // Legacy transaction\n transferTransaction = instructions.reduce(\n (tx, instruction) => tx.add(instruction),\n new Transaction()\n );\n\n // Get a recent block hash\n transferTransaction.recentBlockhash = blockhash;\n // Set the signer\n transferTransaction.feePayer = new PublicKey(this.address);\n } else {\n // VersionedTransaction\n const txMessage = new TransactionMessage({\n payerKey: new PublicKey(this.address),\n recentBlockhash: blockhash,\n instructions,\n });\n\n const versionedTxMessage = txMessage.compileToV0Message();\n transferTransaction = new VersionedTransaction(versionedTxMessage);\n }\n\n return transferTransaction;\n }\n\n /**\n * Adds sponsorship to a transaction. Used to have a party like Alchemy pay for the transaction.\n *\n * @param {TransactionInstruction[]} instructions - The instructions to add to the transaction\n * @param {Connection} connection - The connection to use for the transaction\n * @param {string} [policyId] - The policy ID to add sponsorship to\n * @returns {Promise<VersionedTransaction>} The transaction with sponsorship added\n */\n async addSponsorship(\n instructions: TransactionInstruction[],\n connection: Connection,\n policyId: string\n ): Promise<VersionedTransaction> {\n const { blockhash } = await connection.getLatestBlockhash({\n commitment: \"finalized\",\n });\n const message = new TransactionMessage({\n // Right now the backend will rewrite this payer Key to the server's address\n payerKey: new PublicKey(this.address),\n recentBlockhash: blockhash,\n instructions,\n }).compileToV0Message();\n const versionedTransaction = new VersionedTransaction(message);\n const serializedTransaction = Buffer.from(\n versionedTransaction.serialize()\n ).toString(\"base64\");\n const body = JSON.stringify({\n id: crypto?.randomUUID() ?? Math.floor(Math.random() * 1000000),\n jsonrpc: \"2.0\",\n method: \"alchemy_requestFeePayer\",\n params: [\n {\n policyId,\n serializedTransaction,\n },\n ],\n });\n const options = {\n method: \"POST\",\n headers: {\n accept: \"application/json\",\n \"content-type\": \"application/json\",\n },\n body,\n };\n\n const response = await fetch(\n // TODO: Use the connection??\n connection.rpcEndpoint,\n options\n );\n const jsonResponse = await response.json();\n if (!jsonResponse?.result?.serializedTransaction)\n throw new Error(\n `Response doesn't include the serializedTransaction ${JSON.stringify(\n jsonResponse\n )}`\n );\n return VersionedTransaction.deserialize(\n decodeBase64(jsonResponse.result.serializedTransaction)\n );\n }\n\n private formatSignatureForSolana(signature: Hex): Hex {\n if (size(signature) === 64) return signature;\n\n return slice(signature, 0, 64);\n }\n\n private getMessageToSign(tx: Transaction | VersionedTransaction): Hex {\n let messageToSign;\n if (tx instanceof Transaction) {\n messageToSign = tx.serializeMessage();\n } else {\n messageToSign = Buffer.from(tx.message.serialize());\n }\n return toHex(messageToSign);\n }\n}\nfunction decodeBase64(serializedTransaction: string): Uint8Array {\n return Buffer.from(serializedTransaction, \"base64\");\n}\n"]}
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "4.
|
|
1
|
+
export declare const VERSION = "4.28.0";
|
package/dist/esm/version.js
CHANGED
package/dist/esm/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,yBAAyB;AACzB,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["// This file is autogenerated by inject-version.ts. Any changes will be\n// overwritten on commit!\nexport const VERSION = \"4.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,yBAAyB;AACzB,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["// This file is autogenerated by inject-version.ts. Any changes will be\n// overwritten on commit!\nexport const VERSION = \"4.28.0\";\n"]}
|
package/dist/types/base.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { type SmartAccountAuthenticator } from "@aa-sdk/core";
|
|
|
2
2
|
import { type GetTransactionType, type Hex, type IsNarrowable, type LocalAccount, type SerializeTransactionFn, type SignableMessage, type TransactionSerializable, type TransactionSerialized, type TypedData, type TypedDataDefinition } from "viem";
|
|
3
3
|
import { type Authorization } from "viem/experimental";
|
|
4
4
|
import type { BaseSignerClient } from "./client/base";
|
|
5
|
-
import type { MfaFactor, OauthConfig, User, VerifyMfaParams,
|
|
5
|
+
import type { MfaFactor, OauthConfig, User, VerifyMfaParams, AddMfaParams, AddMfaResult, RemoveMfaParams } from "./client/types";
|
|
6
6
|
import { type SessionManagerParams } from "./session/manager.js";
|
|
7
7
|
import type { AuthParams } from "./signer";
|
|
8
8
|
import { SolanaSigner } from "./solanaSigner.js";
|
|
@@ -507,11 +507,11 @@ export declare abstract class BaseAlchemySigner<TClient extends BaseSignerClient
|
|
|
507
507
|
* // Result contains multiFactorTotpUrl to display as QR code
|
|
508
508
|
* ```
|
|
509
509
|
*
|
|
510
|
-
* @param {
|
|
510
|
+
* @param {AddMfaParams} params The parameters required to enable a new MFA factor
|
|
511
511
|
* @throws {NotAuthenticatedError} If no user is authenticated
|
|
512
|
-
* @returns {Promise<
|
|
512
|
+
* @returns {Promise<AddMfaResult>} A promise that resolves to the factor setup information
|
|
513
513
|
*/
|
|
514
|
-
addMfa: (params:
|
|
514
|
+
addMfa: (params: AddMfaParams) => Promise<AddMfaResult>;
|
|
515
515
|
/**
|
|
516
516
|
* Verifies a newly created MFA factor to complete the setup process.
|
|
517
517
|
*
|
package/dist/types/base.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,EAKL,KAAK,kBAAkB,EACvB,KAAK,GAAG,EACR,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAC3B,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,SAAS,EACd,KAAK,mBAAmB,EACzB,MAAM,MAAM,CAAC;AAEd,OAAO,EAAqB,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAI1E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,KAAK,EA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,EAAE,CACT,MAAM,EAAE,eAAe,KACpB,OAAO,CAAC;QAAE,YAAY,EAAE,SAAS,EAAE,CAAA;KAAE,CAAC,CAKzC;IAEF;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,SAAS,EAAE,CACT,MAAM,EAAE,eAAe,KACpB,OAAO,CAAC;QAAE,YAAY,EAAE,SAAS,EAAE,CAAA;KAAE,CAAC,CAKzC;IAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACU,oBAAoB,CAC/B,MAAM,EAAE,wBAAwB,GAC/B,OAAO,CAAC,IAAI,CAAC;IAyDhB,SAAS,CAAC,UAAU,QAAa,QAAQ,YAAY,CAAC,CAGpD;IAEF;;;;OAIG;IACI,SAAS,QAAa,QAAQ,YAAY,CAAC,CAMhD;IAEF,SAAS,CAAC,WAAW,QAAa,QAAQ,YAAY,CAAC,CAErD;CACH"}
|
|
@@ -2,7 +2,7 @@ import { type ConnectionConfig } from "@aa-sdk/core";
|
|
|
2
2
|
import { TurnkeyClient, type TSignedRequest } from "@turnkey/http";
|
|
3
3
|
import EventEmitter from "eventemitter3";
|
|
4
4
|
import { type Hex } from "viem";
|
|
5
|
-
import type { AlchemySignerClientEvents, AuthenticatingEventMetadata, CreateAccountParams, RemoveMfaParams, EmailAuthParams,
|
|
5
|
+
import type { AlchemySignerClientEvents, AuthenticatingEventMetadata, CreateAccountParams, RemoveMfaParams, EmailAuthParams, AddMfaParams, AddMfaResult, experimental_CreateApiKeyParams, GetOauthProviderUrlArgs, GetWebAuthnAttestationResult, MfaFactor, OauthConfig, OauthParams, OtpParams, SignerBody, SignerResponse, SignupResponse, User, VerifyMfaParams, SubmitOtpCodeResponse, ValidateMultiFactorsParams } from "./types.js";
|
|
6
6
|
export interface BaseSignerClientParams {
|
|
7
7
|
stamper: TurnkeyClient["stamper"];
|
|
8
8
|
connection: ConnectionConfig;
|
|
@@ -62,48 +62,6 @@ export declare abstract class BaseSignerClient<TExportWalletParams = unknown> {
|
|
|
62
62
|
otpId?: string;
|
|
63
63
|
multiFactors?: MfaFactor[];
|
|
64
64
|
}>;
|
|
65
|
-
/**
|
|
66
|
-
* Retrieves the list of MFA factors configured for the current user.
|
|
67
|
-
*
|
|
68
|
-
* @returns {Promise<{ multiFactors: Array<MfaFactor> }>} A promise that resolves to an array of configured MFA factors
|
|
69
|
-
*/
|
|
70
|
-
abstract getMfaFactors(): Promise<{
|
|
71
|
-
multiFactors: MfaFactor[];
|
|
72
|
-
}>;
|
|
73
|
-
/**
|
|
74
|
-
* Initiates the setup of a new MFA factor for the current user. Mfa will need to be verified before it is active.
|
|
75
|
-
*
|
|
76
|
-
* @param {EnableMfaParams} params The parameters required to enable a new MFA factor
|
|
77
|
-
* @returns {Promise<EnableMfaResult>} A promise that resolves to the factor setup information
|
|
78
|
-
*/
|
|
79
|
-
abstract addMfa(params: EnableMfaParams): Promise<EnableMfaResult>;
|
|
80
|
-
/**
|
|
81
|
-
* Verifies a newly created MFA factor to complete the setup process.
|
|
82
|
-
*
|
|
83
|
-
* @param {VerifyMfaParams} params The parameters required to verify the MFA factor
|
|
84
|
-
* @returns {Promise<{ multiFactors: MfaFactor[] }>} A promise that resolves to the updated list of MFA factors
|
|
85
|
-
*/
|
|
86
|
-
abstract verifyMfa(params: VerifyMfaParams): Promise<{
|
|
87
|
-
multiFactors: MfaFactor[];
|
|
88
|
-
}>;
|
|
89
|
-
/**
|
|
90
|
-
* Removes existing MFA factors by ID or factor type.
|
|
91
|
-
*
|
|
92
|
-
* @param {RemoveMfaParams} params The parameters specifying which factors to disable
|
|
93
|
-
* @returns {Promise<{ multiFactors: MfaFactor[] }>} A promise that resolves to the updated list of MFA factors
|
|
94
|
-
*/
|
|
95
|
-
abstract removeMfa(params: RemoveMfaParams): Promise<{
|
|
96
|
-
multiFactors: MfaFactor[];
|
|
97
|
-
}>;
|
|
98
|
-
/**
|
|
99
|
-
* Validates multiple MFA factors using the provided encrypted payload and MFA codes.
|
|
100
|
-
*
|
|
101
|
-
* @param {ValidateMultiFactorsParams} params The validation parameters
|
|
102
|
-
* @returns {Promise<{ bundle: string }>} A promise that resolves to an object containing the credential bundle
|
|
103
|
-
*/
|
|
104
|
-
abstract validateMultiFactors(params: ValidateMultiFactorsParams): Promise<{
|
|
105
|
-
bundle: string;
|
|
106
|
-
}>;
|
|
107
65
|
abstract completeAuthWithBundle(params: {
|
|
108
66
|
bundle: string;
|
|
109
67
|
orgId: string;
|
|
@@ -222,6 +180,54 @@ export declare abstract class BaseSignerClient<TExportWalletParams = unknown> {
|
|
|
222
180
|
* @returns {Promise<SignerResponse<R>>} A promise that resolves to the response from the signer
|
|
223
181
|
*/
|
|
224
182
|
request: <R extends "/v1/signup" | "/v1/whoami" | "/v1/auth" | "/v1/lookup" | "/v1/sign-payload" | "/v1/prepare-oauth" | "/v1/otp" | "/v1/auth-list-multi-factors" | "/v1/auth-delete-multi-factors" | "/v1/auth-request-multi-factor" | "/v1/auth-verify-multi-factor" | "/v1/signer-config" | "/v1/auth-validate-multi-factors">(route: R, body: SignerBody<R>) => Promise<SignerResponse<R>>;
|
|
183
|
+
/**
|
|
184
|
+
* Retrieves the list of MFA factors configured for the current user.
|
|
185
|
+
*
|
|
186
|
+
* @returns {Promise<{ multiFactors: MfaFactor[] }>} A promise that resolves to an array of configured MFA factors
|
|
187
|
+
* @throws {NotAuthenticatedError} If no user is authenticated
|
|
188
|
+
*/
|
|
189
|
+
getMfaFactors: () => Promise<{
|
|
190
|
+
multiFactors: MfaFactor[];
|
|
191
|
+
}>;
|
|
192
|
+
/**
|
|
193
|
+
* Initiates the setup of a new MFA factor for the current user. Mfa will need to be verified before it is active.
|
|
194
|
+
*
|
|
195
|
+
* @param {AddMfaParams} params The parameters required to enable a new MFA factor
|
|
196
|
+
* @returns {Promise<AddMfaResult>} A promise that resolves to the factor setup information
|
|
197
|
+
* @throws {NotAuthenticatedError} If no user is authenticated
|
|
198
|
+
* @throws {Error} If an unsupported factor type is provided
|
|
199
|
+
*/
|
|
200
|
+
addMfa: (params: AddMfaParams) => Promise<AddMfaResult>;
|
|
201
|
+
/**
|
|
202
|
+
* Verifies a newly created MFA factor to complete the setup process.
|
|
203
|
+
*
|
|
204
|
+
* @param {VerifyMfaParams} params The parameters required to verify the MFA factor
|
|
205
|
+
* @returns {Promise<{ multiFactors: MfaFactor[] }>} A promise that resolves to the updated list of MFA factors
|
|
206
|
+
* @throws {NotAuthenticatedError} If no user is authenticated
|
|
207
|
+
*/
|
|
208
|
+
verifyMfa: (params: VerifyMfaParams) => Promise<{
|
|
209
|
+
multiFactors: MfaFactor[];
|
|
210
|
+
}>;
|
|
211
|
+
/**
|
|
212
|
+
* Removes existing MFA factors by ID.
|
|
213
|
+
*
|
|
214
|
+
* @param {RemoveMfaParams} params The parameters specifying which factors to disable
|
|
215
|
+
* @returns {Promise<{ multiFactors: MfaFactor[] }>} A promise that resolves to the updated list of MFA factors
|
|
216
|
+
* @throws {NotAuthenticatedError} If no user is authenticated
|
|
217
|
+
*/
|
|
218
|
+
removeMfa: (params: RemoveMfaParams) => Promise<{
|
|
219
|
+
multiFactors: MfaFactor[];
|
|
220
|
+
}>;
|
|
221
|
+
/**
|
|
222
|
+
* Validates multiple MFA factors using the provided encrypted payload and MFA codes.
|
|
223
|
+
*
|
|
224
|
+
* @param {ValidateMultiFactorsParams} params The validation parameters
|
|
225
|
+
* @returns {Promise<{ bundle: string }>} A promise that resolves to an object containing the credential bundle
|
|
226
|
+
* @throws {Error} If no credential bundle is returned from the server
|
|
227
|
+
*/
|
|
228
|
+
validateMultiFactors: (params: ValidateMultiFactorsParams) => Promise<{
|
|
229
|
+
bundle: string;
|
|
230
|
+
}>;
|
|
225
231
|
private exportAsSeedPhrase;
|
|
226
232
|
private exportAsPrivateKey;
|
|
227
233
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/client/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,gBAAgB,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AsB,0uCAKpB,QACR,WAAW,CAAC,OAAO,IAAI,CAAC,aAAa,CAAC,CAAC,aAAa,CAAC,CAAC,CACvD,CAAC,UAAU,CAAC,kBACG,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAsCtB;IAGF;;;;;OAKG;IACH,SAAS,CAAC,aAAa,qBAAsB,MAAM,KAAG,MAAM,CAE1D;CACH"}
|
|
@@ -2,7 +2,7 @@ import { BaseError } from "@aa-sdk/core";
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import type { AuthParams } from "../signer.js";
|
|
4
4
|
import { BaseSignerClient } from "./base.js";
|
|
5
|
-
import type { AlchemySignerClientEvents, AuthenticatingEventMetadata, CreateAccountParams, CredentialCreationOptionOverrides, EmailAuthParams, ExportWalletParams, OauthConfig, OtpParams, User,
|
|
5
|
+
import type { AlchemySignerClientEvents, AuthenticatingEventMetadata, CreateAccountParams, CredentialCreationOptionOverrides, EmailAuthParams, ExportWalletParams, OauthConfig, OtpParams, User, SubmitOtpCodeResponse } from "./types.js";
|
|
6
6
|
export declare const AlchemySignerClientParamsSchema: z.ZodObject<{
|
|
7
7
|
connection: z.ZodUnion<[z.ZodObject<{
|
|
8
8
|
rpcUrl: z.ZodOptional<z.ZodNever>;
|
|
@@ -203,7 +203,7 @@ export declare class AlchemySignerWebClient extends BaseSignerClient<ExportWalle
|
|
|
203
203
|
initEmailAuth: (params: Omit<EmailAuthParams, "targetPublicKey">) => Promise<{
|
|
204
204
|
orgId: string;
|
|
205
205
|
otpId?: string | undefined;
|
|
206
|
-
multiFactors?: MfaFactor[] | undefined;
|
|
206
|
+
multiFactors?: import("./types.js").MfaFactor[] | undefined;
|
|
207
207
|
}>;
|
|
208
208
|
/**
|
|
209
209
|
* Authenticates using an OTP code which was previously received via email.
|
|
@@ -437,54 +437,6 @@ export declare class AlchemySignerWebClient extends BaseSignerClient<ExportWalle
|
|
|
437
437
|
};
|
|
438
438
|
}>;
|
|
439
439
|
protected getOauthConfig: () => Promise<OauthConfig>;
|
|
440
|
-
/**
|
|
441
|
-
* Retrieves the list of MFA factors configured for the current user.
|
|
442
|
-
*
|
|
443
|
-
* @returns {Promise<{ multiFactors: MfaFactor[] }>} A promise that resolves to an array of configured MFA factors
|
|
444
|
-
* @throws {NotAuthenticatedError} If no user is authenticated
|
|
445
|
-
*/
|
|
446
|
-
getMfaFactors: () => Promise<{
|
|
447
|
-
multiFactors: MfaFactor[];
|
|
448
|
-
}>;
|
|
449
|
-
/**
|
|
450
|
-
* Initiates the setup of a new MFA factor for the current user. Mfa will need to be verified before it is active.
|
|
451
|
-
*
|
|
452
|
-
* @param {EnableMfaParams} params The parameters required to enable a new MFA factor
|
|
453
|
-
* @returns {Promise<EnableMfaResult>} A promise that resolves to the factor setup information
|
|
454
|
-
* @throws {NotAuthenticatedError} If no user is authenticated
|
|
455
|
-
* @throws {Error} If an unsupported factor type is provided
|
|
456
|
-
*/
|
|
457
|
-
addMfa: (params: EnableMfaParams) => Promise<EnableMfaResult>;
|
|
458
|
-
/**
|
|
459
|
-
* Verifies a newly created MFA factor to complete the setup process.
|
|
460
|
-
*
|
|
461
|
-
* @param {VerifyMfaParams} params The parameters required to verify the MFA factor
|
|
462
|
-
* @returns {Promise<{ multiFactors: MfaFactor[] }>} A promise that resolves to the updated list of MFA factors
|
|
463
|
-
* @throws {NotAuthenticatedError} If no user is authenticated
|
|
464
|
-
*/
|
|
465
|
-
verifyMfa: (params: VerifyMfaParams) => Promise<{
|
|
466
|
-
multiFactors: MfaFactor[];
|
|
467
|
-
}>;
|
|
468
|
-
/**
|
|
469
|
-
* Removes existing MFA factors by ID.
|
|
470
|
-
*
|
|
471
|
-
* @param {RemoveMfaParams} params The parameters specifying which factors to disable
|
|
472
|
-
* @returns {Promise<{ multiFactors: MfaFactor[] }>} A promise that resolves to the updated list of MFA factors
|
|
473
|
-
* @throws {NotAuthenticatedError} If no user is authenticated
|
|
474
|
-
*/
|
|
475
|
-
removeMfa: (params: RemoveMfaParams) => Promise<{
|
|
476
|
-
multiFactors: MfaFactor[];
|
|
477
|
-
}>;
|
|
478
|
-
/**
|
|
479
|
-
* Validates multiple MFA factors using the provided encrypted payload and MFA codes.
|
|
480
|
-
*
|
|
481
|
-
* @param {ValidateMultiFactorsParams} params The validation parameters
|
|
482
|
-
* @returns {Promise<{ bundle: string }>} A promise that resolves to an object containing the credential bundle
|
|
483
|
-
* @throws {Error} If no credential bundle is returned from the server
|
|
484
|
-
*/
|
|
485
|
-
validateMultiFactors(params: ValidateMultiFactorsParams): Promise<{
|
|
486
|
-
bundle: string;
|
|
487
|
-
}>;
|
|
488
440
|
}
|
|
489
441
|
/**
|
|
490
442
|
* This error is thrown when the OAuth flow is cancelled because the auth popup
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA0B,MAAM,cAAc,CAAC;AAIjE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EACV,yBAAyB,EACzB,2BAA2B,EAC3B,mBAAmB,EACnB,iCAAiC,EACjC,eAAe,EACf,kBAAkB,EAClB,WAAW,EACX,SAAS,EACT,IAAI,EACJ,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA0B,MAAM,cAAc,CAAC;AAIjE,OAAO,EAAE,CAAC,EAAE,MAAM,KAA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iFactorType;
|
|
185
185
|
};
|
|
186
|
-
Response:
|
|
186
|
+
Response: AddMfaResult;
|
|
187
187
|
},
|
|
188
188
|
{
|
|
189
189
|
Route: "/v1/auth-verify-multi-factor";
|
|
@@ -253,10 +253,10 @@ export type MfaFactor = {
|
|
|
253
253
|
multiFactorType: string;
|
|
254
254
|
};
|
|
255
255
|
type MultiFactorType = "totp";
|
|
256
|
-
export type
|
|
256
|
+
export type AddMfaParams = {
|
|
257
257
|
multiFactorType: MultiFactorType;
|
|
258
258
|
};
|
|
259
|
-
export type
|
|
259
|
+
export type AddMfaResult = {
|
|
260
260
|
multiFactorType: MultiFactorType;
|
|
261
261
|
multiFactorId: string;
|
|
262
262
|
multiFactorTotpUrl: string;
|
|
@@ -270,10 +270,7 @@ export type RemoveMfaParams = {
|
|
|
270
270
|
};
|
|
271
271
|
export type ValidateMultiFactorsParams = {
|
|
272
272
|
encryptedPayload: string;
|
|
273
|
-
multiFactors:
|
|
274
|
-
multiFactorId: string;
|
|
275
|
-
multiFactorCode: string;
|
|
276
|
-
}>;
|
|
273
|
+
multiFactors: VerifyMfaParams[];
|
|
277
274
|
};
|
|
278
275
|
export type MfaChallenge = {
|
|
279
276
|
multiFactorId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/client/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAC5E,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5C,MAAM,MAAM,iCAAiC,GAAG;IAC9C,SAAS,CAAC,EAAE,OAAO,CAAC,yBAAyB,CAAC,WAAW,CAAC,CAAC,CAAC;CAC7D,GAAG,IAAI,CAAC,yBAAyB,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CAAC;AAC3B,mBAAmB,mBAAmB,CAAC;AACvC,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,kBAAkB,EAClB,0BAA0B,GAC3B,MAAM,sBAAsB,CAAC;AAC9B,mBAAmB,aAAa,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,mBAAmB,mBAAmB,CAAC;AACvC,mBAAmB,YAAY,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,mBAAmB,mBAAmB,CAAC;AACvC,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,kBAAkB,EAClB,0BAA0B,GAC3B,MAAM,sBAAsB,CAAC;AAC9B,mBAAmB,aAAa,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,mBAAmB,mBAAmB,CAAC;AACvC,mBAAmB,YAAY,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,12 +1,45 @@
|
|
|
1
|
-
import { Transaction,
|
|
1
|
+
import { Connection, Transaction, TransactionInstruction, VersionedTransaction } from "@solana/web3.js";
|
|
2
2
|
import { type ByteArray } from "viem";
|
|
3
3
|
import type { BaseSignerClient } from "./client/base";
|
|
4
|
+
/**
|
|
5
|
+
* The SolanaSigner class is used to sign transactions and messages for the Solana blockchain.
|
|
6
|
+
* It provides methods to add signatures to transactions and sign messages.
|
|
7
|
+
*/
|
|
4
8
|
export declare class SolanaSigner {
|
|
5
|
-
|
|
6
|
-
address: string;
|
|
9
|
+
readonly alchemyClient: BaseSignerClient;
|
|
10
|
+
readonly address: string;
|
|
11
|
+
/**
|
|
12
|
+
* Constructor for the SolanaSigner class which is a wrapper around the alchemy client, and is more focused on the solana web3
|
|
13
|
+
*
|
|
14
|
+
* @param {object} client This is the client that will be used to sign the transaction, and we are just having functions on top of it.
|
|
15
|
+
*/
|
|
7
16
|
constructor(client: BaseSignerClient);
|
|
8
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Adds a signature of the client user to a transaction
|
|
19
|
+
*
|
|
20
|
+
* @param {Transaction | VersionedTransaction} transaction - The transaction to add the signature to
|
|
21
|
+
* @returns {Promise<Transaction | VersionedTransaction >} The transaction with the signature added
|
|
22
|
+
*/
|
|
23
|
+
addSignature(transaction: Transaction | VersionedTransaction): Promise<Transaction | VersionedTransaction>;
|
|
24
|
+
/**
|
|
25
|
+
* Signs a message
|
|
26
|
+
*
|
|
27
|
+
* @param {Uint8Array} message - The message to sign
|
|
28
|
+
* @returns {Promise<ByteArray>} The signature of the message
|
|
29
|
+
*/
|
|
9
30
|
signMessage(message: Uint8Array): Promise<ByteArray>;
|
|
31
|
+
createTransfer(instructions: TransactionInstruction[], connection: Connection, version?: "versioned"): Promise<VersionedTransaction>;
|
|
32
|
+
createTransfer(instructions: TransactionInstruction[], connection: Connection, version?: "legacy"): Promise<Transaction>;
|
|
33
|
+
createTransfer(instructions: TransactionInstruction[], connection: Connection): Promise<VersionedTransaction>;
|
|
34
|
+
/**
|
|
35
|
+
* Adds sponsorship to a transaction. Used to have a party like Alchemy pay for the transaction.
|
|
36
|
+
*
|
|
37
|
+
* @param {TransactionInstruction[]} instructions - The instructions to add to the transaction
|
|
38
|
+
* @param {Connection} connection - The connection to use for the transaction
|
|
39
|
+
* @param {string} [policyId] - The policy ID to add sponsorship to
|
|
40
|
+
* @returns {Promise<VersionedTransaction>} The transaction with sponsorship added
|
|
41
|
+
*/
|
|
42
|
+
addSponsorship(instructions: TransactionInstruction[], connection: Connection, policyId: string): Promise<VersionedTransaction>;
|
|
10
43
|
private formatSignatureForSolana;
|
|
11
44
|
private getMessageToSign;
|
|
12
45
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solanaSigner.d.ts","sourceRoot":"","sources":["../../src/solanaSigner.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"solanaSigner.d.ts","sourceRoot":"","sources":["../../src/solanaSigner.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAEV,WAAW,EACX,sBAAsB,EAEtB,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAA+B,KAAK,SAAS,EAAY,MAAM,MAAM,CAAC;AAC7E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAGtD;;;GAGG;AACH,qBAAa,YAAY;IACvB,QAAQ,CAAC,aAAa,EAAE,gBAAgB,CAAC;IACzC,SAAgB,OAAO,EAAE,MAAM,CAAC;IAEhC;;;;OAIG;gBACS,MAAM,EAAE,gBAAgB;IAQpC;;;;;OAKG;IACG,YAAY,CAChB,WAAW,EAAE,WAAW,GAAG,oBAAoB,GAC9C,OAAO,CAAC,WAAW,GAAG,oBAAoB,CAAC;IAwB9C;;;;;OAKG;IACG,WAAW,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC;IAmBpD,cAAc,CAClB,YAAY,EAAE,sBAAsB,EAAE,EACtC,UAAU,EAAE,UAAU,EACtB,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,oBAAoB,CAAC;IAC1B,cAAc,CAClB,YAAY,EAAE,sBAAsB,EAAE,EACtC,UAAU,EAAE,UAAU,EACtB,OAAO,CAAC,EAAE,QAAQ,GACjB,OAAO,CAAC,WAAW,CAAC;IACjB,cAAc,CAClB,YAAY,EAAE,sBAAsB,EAAE,EACtC,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,oBAAoB,CAAC;IA6ChC;;;;;;;OAOG;IACG,cAAc,CAClB,YAAY,EAAE,sBAAsB,EAAE,EACtC,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,oBAAoB,CAAC;IAmDhC,OAAO,CAAC,wBAAwB;IAMhC,OAAO,CAAC,gBAAgB;CASzB"}
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "4.
|
|
1
|
+
export declare const VERSION = "4.28.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|