@solana/actions
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -17,9 +17,9 @@ "use strict"; | ||
const web3_js_1 = require("@solana/web3.js"); | ||
const bs58_1 = __importDefault(require("bs58")); | ||
const tweetnacl_1 = __importDefault(require("tweetnacl")); | ||
const constants_1 = require("./constants"); | ||
const bs58_1 = __importDefault(require("bs58")); | ||
const findReference_1 = require("./findReference"); | ||
const constants_js_1 = require("./constants.js"); | ||
const findReference_js_1 = require("./findReference.js"); | ||
const ACTIONS_IDENTITY_SCHEMA = { | ||
separator: ":", | ||
protocol: constants_1.SOLANA_ACTIONS_PROTOCOL.replace(":", ""), | ||
protocol: constants_js_1.SOLANA_ACTIONS_PROTOCOL.replace(":", ""), | ||
/** avoids magic numbers */ | ||
@@ -33,8 +33,2 @@ scheme: { | ||
}; | ||
// enum IdentifierFields { | ||
// Protocol = 0, | ||
// Identity = 1, | ||
// Data = 2, // i.e `reference` key | ||
// Signature = 3, | ||
// } | ||
function createActionIdentifierMemo(identity, reference) { | ||
@@ -123,3 +117,3 @@ const signature = tweetnacl_1.default.sign.detached(reference.toBytes(), identity.secretKey); | ||
return false; | ||
const confirmedSigInfo = yield (0, findReference_1.findReference)(connection, new web3_js_1.PublicKey(validated.reference)); | ||
const confirmedSigInfo = yield (0, findReference_js_1.findReference)(connection, new web3_js_1.PublicKey(validated.reference)); | ||
if (confirmedSigInfo.signature === sigInfo.signature) | ||
@@ -144,3 +138,3 @@ return true; | ||
instruction: new web3_js_1.TransactionInstruction({ | ||
programId: new web3_js_1.PublicKey(constants_1.MEMO_PROGRAM_ID), | ||
programId: new web3_js_1.PublicKey(constants_js_1.MEMO_PROGRAM_ID), | ||
data: Buffer.from(memo, "utf8"), | ||
@@ -147,0 +141,0 @@ // Adding any keys will trigger the memo instruction to require they sign |
@@ -14,4 +14,4 @@ "use strict"; | ||
const web3_js_1 = require("@solana/web3.js"); | ||
const constants_1 = require("./constants"); | ||
const actionIdentity_1 = require("./actionIdentity"); | ||
const constants_js_1 = require("./constants.js"); | ||
const actionIdentity_js_1 = require("./actionIdentity.js"); | ||
/** | ||
@@ -41,3 +41,3 @@ * Thrown when the Action POST response cannot be created. | ||
try { | ||
actionIdentity = (0, actionIdentity_1.getActionIdentityFromEnv)(); | ||
actionIdentity = (0, actionIdentity_js_1.getActionIdentityFromEnv)(); | ||
} | ||
@@ -52,5 +52,5 @@ catch (err) { | ||
if (actionIdentity) { | ||
const { instruction, reference: finalReference } = (0, actionIdentity_1.createActionIdentifierInstruction)(actionIdentity, reference); | ||
const { instruction, reference: finalReference } = (0, actionIdentity_js_1.createActionIdentifierInstruction)(actionIdentity, reference); | ||
transaction.add(instruction); | ||
const memoId = new web3_js_1.PublicKey(constants_1.MEMO_PROGRAM_ID); | ||
const memoId = new web3_js_1.PublicKey(constants_js_1.MEMO_PROGRAM_ID); | ||
const nonMemoIndex = transaction.instructions.findIndex((ix) => ix.programId.toBase58() !== memoId.toBase58()); | ||
@@ -57,0 +57,0 @@ if (nonMemoIndex == -1) { |
import { Keypair, PublicKey, TransactionInstruction, } from "@solana/web3.js"; | ||
import bs58 from "bs58"; | ||
import nacl from "tweetnacl"; | ||
import { MEMO_PROGRAM_ID, SOLANA_ACTIONS_PROTOCOL } from "./constants"; | ||
import bs58 from "bs58"; | ||
import { findReference } from "./findReference"; | ||
import { MEMO_PROGRAM_ID, SOLANA_ACTIONS_PROTOCOL } from "./constants.js"; | ||
import { findReference } from "./findReference.js"; | ||
const ACTIONS_IDENTITY_SCHEMA = { | ||
@@ -17,8 +17,2 @@ separator: ":", | ||
}; | ||
// enum IdentifierFields { | ||
// Protocol = 0, | ||
// Identity = 1, | ||
// Data = 2, // i.e `reference` key | ||
// Signature = 3, | ||
// } | ||
export function createActionIdentifierMemo(identity, reference) { | ||
@@ -25,0 +19,0 @@ const signature = nacl.sign.detached(reference.toBytes(), identity.secretKey); |
@@ -1,4 +0,4 @@ | ||
import { PublicKey, } from "@solana/web3.js"; | ||
import { MEMO_PROGRAM_ID } from "./constants"; | ||
import { createActionIdentifierInstruction, getActionIdentityFromEnv, } from "./actionIdentity"; | ||
import { PublicKey } from "@solana/web3.js"; | ||
import { MEMO_PROGRAM_ID } from "./constants.js"; | ||
import { createActionIdentifierInstruction, getActionIdentityFromEnv, } from "./actionIdentity.js"; | ||
/** | ||
@@ -5,0 +5,0 @@ * Thrown when the Action POST response cannot be created. |
import { ConfirmedSignatureInfo, Connection, Keypair, PublicKey, Signer, TransactionInstruction } from "@solana/web3.js"; | ||
import type { Reference } from "./types"; | ||
import type { Reference } from "./types.js"; | ||
export declare function createActionIdentifierMemo(identity: Signer, reference: Reference): string; | ||
@@ -4,0 +4,0 @@ /** |
import { Commitment, Signer } from "@solana/web3.js"; | ||
import { Transaction } from "@solana/web3.js"; | ||
import { ActionPostResponse, Reference } from "./types"; | ||
import { ActionPostResponse, Reference } from "./types.js"; | ||
/** | ||
@@ -5,0 +5,0 @@ * Thrown when the Action POST response cannot be created. |
import { Commitment, Connection, PublicKey } from "@solana/web3.js"; | ||
import { Transaction } from "@solana/web3.js"; | ||
import { ActionPostRequest, ActionPostResponse } from "./types"; | ||
import { ActionPostRequest, ActionPostResponse } from "./types.js"; | ||
/** | ||
@@ -5,0 +5,0 @@ * Thrown when a transaction response can't be fetched. |
{ | ||
"name": "@solana/actions", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"author": "Solana Maintainers <maintainers@solana.foundation>", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/solana-developers/solana-actions", |
@@ -9,7 +9,7 @@ import { | ||
} from "@solana/web3.js"; | ||
import bs58 from "bs58"; | ||
import nacl from "tweetnacl"; | ||
import type { Reference } from "./types"; | ||
import { MEMO_PROGRAM_ID, SOLANA_ACTIONS_PROTOCOL } from "./constants"; | ||
import bs58 from "bs58"; | ||
import { findReference } from "./findReference"; | ||
import type { Reference } from "./types.js"; | ||
import { MEMO_PROGRAM_ID, SOLANA_ACTIONS_PROTOCOL } from "./constants.js"; | ||
import { findReference } from "./findReference.js"; | ||
@@ -28,9 +28,2 @@ const ACTIONS_IDENTITY_SCHEMA = { | ||
// enum IdentifierFields { | ||
// Protocol = 0, | ||
// Identity = 1, | ||
// Data = 2, // i.e `reference` key | ||
// Signature = 3, | ||
// } | ||
export function createActionIdentifierMemo( | ||
@@ -37,0 +30,0 @@ identity: Signer, |
@@ -1,18 +0,9 @@ | ||
import { | ||
Commitment, | ||
ComputeBudgetInstruction, | ||
ComputeBudgetProgram, | ||
Connection, | ||
PublicKey, | ||
Signer, | ||
TransactionInstruction, | ||
} from "@solana/web3.js"; | ||
import { Commitment, PublicKey, Signer } from "@solana/web3.js"; | ||
import { Transaction } from "@solana/web3.js"; | ||
import { toUint8Array } from "js-base64"; | ||
import { ActionPostResponse, Reference } from "./types"; | ||
import { MEMO_PROGRAM_ID } from "./constants"; | ||
import { ActionPostResponse, Reference } from "./types.js"; | ||
import { MEMO_PROGRAM_ID } from "./constants.js"; | ||
import { | ||
createActionIdentifierInstruction, | ||
getActionIdentityFromEnv, | ||
} from "./actionIdentity"; | ||
} from "./actionIdentity.js"; | ||
@@ -19,0 +10,0 @@ /** |
@@ -6,3 +6,3 @@ import { Commitment, Connection, PublicKey } from "@solana/web3.js"; | ||
import nacl from "tweetnacl"; | ||
import { ActionPostRequest, ActionPostResponse } from "./types"; | ||
import { ActionPostRequest, ActionPostResponse } from "./types.js"; | ||
@@ -9,0 +9,0 @@ /** |
@@ -6,3 +6,3 @@ import type { PublicKey } from "@solana/web3.js"; | ||
SOLANA_PAY_PROTOCOL, | ||
} from "./constants"; | ||
} from "./constants.js"; | ||
@@ -9,0 +9,0 @@ /** `reference` in the [Solana Actions spec](https://github.com/solana-labs/solana-pay/blob/master/SPEC.md#reference). */ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
138496
2209