@dimcool/mcp 0.1.13 → 0.1.14
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/index.js +38 -30
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -21539,6 +21539,27 @@ var VoteAccountLayout = BufferLayout.struct([
|
|
|
21539
21539
|
BufferLayout.seq(BufferLayout.struct([BufferLayout.nu64("epoch"), BufferLayout.nu64("credits"), BufferLayout.nu64("prevCredits")]), BufferLayout.offset(BufferLayout.u32(), -8), "epochCredits"),
|
|
21540
21540
|
BufferLayout.struct([BufferLayout.nu64("slot"), BufferLayout.nu64("timestamp")], "lastTimestamp")
|
|
21541
21541
|
]);
|
|
21542
|
+
function base64ToBytes(base64) {
|
|
21543
|
+
if (typeof Buffer !== "undefined") {
|
|
21544
|
+
return Buffer.from(base64, "base64");
|
|
21545
|
+
}
|
|
21546
|
+
const binary = atob(base64);
|
|
21547
|
+
const bytes = new Uint8Array(binary.length);
|
|
21548
|
+
for (let i = 0; i < binary.length; i++) {
|
|
21549
|
+
bytes[i] = binary.charCodeAt(i);
|
|
21550
|
+
}
|
|
21551
|
+
return bytes;
|
|
21552
|
+
}
|
|
21553
|
+
function bytesToBase64(bytes) {
|
|
21554
|
+
if (typeof Buffer !== "undefined") {
|
|
21555
|
+
return Buffer.from(bytes).toString("base64");
|
|
21556
|
+
}
|
|
21557
|
+
let binary = "";
|
|
21558
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
21559
|
+
binary += String.fromCharCode(bytes[i]);
|
|
21560
|
+
}
|
|
21561
|
+
return btoa(binary);
|
|
21562
|
+
}
|
|
21542
21563
|
var HttpClient = class {
|
|
21543
21564
|
constructor(baseUrl, storage, logger2, appId, autoPayConfig) {
|
|
21544
21565
|
this.baseUrl = baseUrl.replace(/\/$/, "");
|
|
@@ -21810,11 +21831,11 @@ var HttpClient = class {
|
|
|
21810
21831
|
}
|
|
21811
21832
|
}
|
|
21812
21833
|
);
|
|
21813
|
-
const unsignedTx = Transaction.from(
|
|
21814
|
-
Buffer.from(prepare.transaction, "base64")
|
|
21815
|
-
);
|
|
21834
|
+
const unsignedTx = Transaction.from(base64ToBytes(prepare.transaction));
|
|
21816
21835
|
const signedTx = await this.signTransactionHandler(unsignedTx);
|
|
21817
|
-
const signedTransaction =
|
|
21836
|
+
const signedTransaction = bytesToBase64(
|
|
21837
|
+
signedTx.serialize({ requireAllSignatures: false })
|
|
21838
|
+
);
|
|
21818
21839
|
const submitted = await this.post(
|
|
21819
21840
|
"/payments/submit",
|
|
21820
21841
|
{
|
|
@@ -21828,19 +21849,6 @@ var HttpClient = class {
|
|
|
21828
21849
|
return submitted.paymentProof;
|
|
21829
21850
|
}
|
|
21830
21851
|
};
|
|
21831
|
-
function toBase64(bytes) {
|
|
21832
|
-
if (typeof Buffer !== "undefined") {
|
|
21833
|
-
return Buffer.from(bytes).toString("base64");
|
|
21834
|
-
}
|
|
21835
|
-
let binary = "";
|
|
21836
|
-
for (let i = 0; i < bytes.length; i++) {
|
|
21837
|
-
binary += String.fromCharCode(bytes[i]);
|
|
21838
|
-
}
|
|
21839
|
-
if (typeof btoa === "undefined") {
|
|
21840
|
-
throw new Error("Base64 encoding is not available in this environment");
|
|
21841
|
-
}
|
|
21842
|
-
return btoa(binary);
|
|
21843
|
-
}
|
|
21844
21852
|
var Auth = class {
|
|
21845
21853
|
constructor(http2, storage, wallet, logger2) {
|
|
21846
21854
|
this.http = http2;
|
|
@@ -21905,7 +21913,7 @@ var Auth = class {
|
|
|
21905
21913
|
}
|
|
21906
21914
|
const { message } = await this.generateHandshake(address);
|
|
21907
21915
|
const signatureResult = await this.wallet.signMessage(message);
|
|
21908
|
-
const signedMessage = typeof signatureResult === "string" ? signatureResult :
|
|
21916
|
+
const signedMessage = typeof signatureResult === "string" ? signatureResult : bytesToBase64(signatureResult);
|
|
21909
21917
|
this.logger.debug("Auth.loginWithWallet called", {
|
|
21910
21918
|
address,
|
|
21911
21919
|
walletMeta: options?.walletMeta
|
|
@@ -22379,11 +22387,11 @@ var Games = class {
|
|
|
22379
22387
|
);
|
|
22380
22388
|
}
|
|
22381
22389
|
const prepared = await this.prepareGameDonation(gameId, amountMinor);
|
|
22382
|
-
const unsignedTx = Transaction.from(
|
|
22383
|
-
Buffer.from(prepared.transaction, "base64")
|
|
22384
|
-
);
|
|
22390
|
+
const unsignedTx = Transaction.from(base64ToBytes(prepared.transaction));
|
|
22385
22391
|
const signedTx = await this.wallet.signTransaction(unsignedTx);
|
|
22386
|
-
const signedTransaction =
|
|
22392
|
+
const signedTransaction = bytesToBase64(
|
|
22393
|
+
signedTx.serialize({ requireAllSignatures: false })
|
|
22394
|
+
);
|
|
22387
22395
|
const result = await this.donateToGame(
|
|
22388
22396
|
gameId,
|
|
22389
22397
|
amountMinor,
|
|
@@ -22651,11 +22659,11 @@ var Tips = class {
|
|
|
22651
22659
|
}
|
|
22652
22660
|
const { publicKey: senderAddress } = await this.wallet.loadWallet();
|
|
22653
22661
|
const prepared = await this.prepare({ recipientUsername, amount });
|
|
22654
|
-
const unsignedTx = Transaction.from(
|
|
22655
|
-
Buffer.from(prepared.transaction, "base64")
|
|
22656
|
-
);
|
|
22662
|
+
const unsignedTx = Transaction.from(base64ToBytes(prepared.transaction));
|
|
22657
22663
|
const signedTx = await this.wallet.signTransaction(unsignedTx);
|
|
22658
|
-
const signedTxBase64 =
|
|
22664
|
+
const signedTxBase64 = bytesToBase64(
|
|
22665
|
+
signedTx.serialize({ requireAllSignatures: false })
|
|
22666
|
+
);
|
|
22659
22667
|
const transfer = await this.wallet.submitTransfer(
|
|
22660
22668
|
signedTxBase64,
|
|
22661
22669
|
senderAddress,
|
|
@@ -23020,11 +23028,11 @@ var Wallet = class {
|
|
|
23020
23028
|
amount,
|
|
23021
23029
|
token
|
|
23022
23030
|
);
|
|
23023
|
-
const unsignedTx = Transaction.from(
|
|
23024
|
-
Buffer.from(prepared.transaction, "base64")
|
|
23025
|
-
);
|
|
23031
|
+
const unsignedTx = Transaction.from(base64ToBytes(prepared.transaction));
|
|
23026
23032
|
const signedTx = await this.signTransaction(unsignedTx);
|
|
23027
|
-
const signedTxBase64 =
|
|
23033
|
+
const signedTxBase64 = bytesToBase64(
|
|
23034
|
+
signedTx.serialize({ requireAllSignatures: false })
|
|
23035
|
+
);
|
|
23028
23036
|
const submitted = await this.submitTransfer(
|
|
23029
23037
|
signedTxBase64,
|
|
23030
23038
|
senderAddress,
|