Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@solana/actions

Package Overview
Dependencies
Maintainers
14
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@solana/actions - npm Package Compare versions

Comparing version 1.1.2 to 1.2.0

2

lib/cjs/actionIdentity.js

@@ -23,3 +23,3 @@ "use strict";

separator: ":",
protocol: constants_js_1.SOLANA_ACTIONS_PROTOCOL.replace(":", ""),
protocol: "solana-action:".replace(":", ""),
/** avoids magic numbers */

@@ -26,0 +26,0 @@ scheme: {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ACTIONS_CORS_HEADERS = exports.BLINKS_QUERY_PARAM = exports.MEMO_PROGRAM_ID = exports.HTTPS_PROTOCOL = exports.SOLANA_ACTIONS_PROTOCOL_PLURAL = exports.SOLANA_ACTIONS_PROTOCOL = exports.SOLANA_PAY_PROTOCOL = void 0;
exports.ACTIONS_CORS_HEADERS = exports.BLINKS_QUERY_PARAM = exports.MEMO_PROGRAM_ID = exports.HTTPS_PROTOCOL = void 0;
/** @internal */
exports.SOLANA_PAY_PROTOCOL = "solana:";
/** @internal */
exports.SOLANA_ACTIONS_PROTOCOL = "solana-action:";
/** @internal */
exports.SOLANA_ACTIONS_PROTOCOL_PLURAL = "solana-actions:";
/** @internal */
exports.HTTPS_PROTOCOL = "https:";

@@ -12,0 +6,0 @@ /** Program Id for the SPL Memo program */

@@ -22,3 +22,3 @@ "use strict";

*/
function encodeURL(fields, protocol = constants_js_1.SOLANA_ACTIONS_PROTOCOL) {
function encodeURL(fields, protocol = "solana-action:") {
if ("blink" in fields)

@@ -29,3 +29,3 @@ return encodeBlinkURL(fields, protocol);

exports.encodeURL = encodeURL;
function encodeActionRequestURL({ link, label, message }, protocol = constants_js_1.SOLANA_ACTIONS_PROTOCOL) {
function encodeActionRequestURL({ link, label, message }, protocol = "solana-action:") {
// Remove trailing slashes

@@ -32,0 +32,0 @@ const pathname = link.search

@@ -31,5 +31,4 @@ "use strict";

}
if (url.protocol !== constants_js_1.SOLANA_PAY_PROTOCOL &&
url.protocol !== constants_js_1.SOLANA_ACTIONS_PROTOCOL &&
url.protocol !== constants_js_1.SOLANA_ACTIONS_PROTOCOL_PLURAL) {
const protocol = url.protocol;
if (protocol !== "solana:" && protocol !== "solana-action:") {
throw new ParseURLError("protocol invalid");

@@ -36,0 +35,0 @@ }

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.js";
import { MEMO_PROGRAM_ID } from "./constants.js";
import { findReference } from "./findReference.js";
const ACTIONS_IDENTITY_SCHEMA = {
separator: ":",
protocol: SOLANA_ACTIONS_PROTOCOL.replace(":", ""),
protocol: "solana-action:".replace(":", ""),
/** avoids magic numbers */

@@ -10,0 +10,0 @@ scheme: {

/** @internal */
export const SOLANA_PAY_PROTOCOL = "solana:";
/** @internal */
export const SOLANA_ACTIONS_PROTOCOL = "solana-action:";
/** @internal */
export const SOLANA_ACTIONS_PROTOCOL_PLURAL = "solana-actions:";
/** @internal */
export const HTTPS_PROTOCOL = "https:";

@@ -9,0 +3,0 @@ /** Program Id for the SPL Memo program */

@@ -1,2 +0,2 @@

import { BLINKS_QUERY_PARAM, SOLANA_ACTIONS_PROTOCOL } from "./constants.js";
import { BLINKS_QUERY_PARAM } from "./constants.js";
/**

@@ -18,3 +18,3 @@ * Thrown when fields cannot be encoded as a blink or Solana Action URL.

*/
export function encodeURL(fields, protocol = SOLANA_ACTIONS_PROTOCOL) {
export function encodeURL(fields, protocol = "solana-action:") {
if ("blink" in fields)

@@ -24,3 +24,3 @@ return encodeBlinkURL(fields, protocol);

}
function encodeActionRequestURL({ link, label, message }, protocol = SOLANA_ACTIONS_PROTOCOL) {
function encodeActionRequestURL({ link, label, message }, protocol = "solana-action:") {
// Remove trailing slashes

@@ -27,0 +27,0 @@ const pathname = link.search

@@ -1,2 +0,2 @@

import { BLINKS_QUERY_PARAM, HTTPS_PROTOCOL, SOLANA_ACTIONS_PROTOCOL, SOLANA_ACTIONS_PROTOCOL_PLURAL, SOLANA_PAY_PROTOCOL, } from "./constants.js";
import { BLINKS_QUERY_PARAM, HTTPS_PROTOCOL } from "./constants.js";
/**

@@ -27,5 +27,4 @@ * Thrown when a URL can't be parsed as a Solana Action URL.

}
if (url.protocol !== SOLANA_PAY_PROTOCOL &&
url.protocol !== SOLANA_ACTIONS_PROTOCOL &&
url.protocol !== SOLANA_ACTIONS_PROTOCOL_PLURAL) {
const protocol = url.protocol;
if (protocol !== "solana:" && protocol !== "solana-action:") {
throw new ParseURLError("protocol invalid");

@@ -32,0 +31,0 @@ }

import { Commitment, Signer } from "@solana/web3.js";
import { Transaction } from "@solana/web3.js";
import { ActionPostResponse, Reference } from "./types.js";
import type { Reference } from "./types.js";
import { ActionPostResponse } from "@solana/actions-spec";
/**

@@ -5,0 +6,0 @@ * Thrown when the Action POST response cannot be created.

@@ -1,2 +0,3 @@

import type { ActionRequestURLFields, BlinkURLFields, SupportedProtocols } from "./types.js";
import { SupportedProtocols } from "@solana/actions-spec";
import type { ActionRequestURLFields, BlinkURLFields } from "./types.js";
/**

@@ -3,0 +4,0 @@ * Thrown when fields cannot be encoded as a blink or Solana Action URL.

@@ -0,4 +1,4 @@

import { ActionPostRequest, ActionPostResponse } from "@solana/actions-spec";
import { Commitment, Connection, PublicKey } from "@solana/web3.js";
import { Transaction } from "@solana/web3.js";
import { ActionPostRequest, ActionPostResponse } from "./types.js";
/**

@@ -5,0 +5,0 @@ * Thrown when a transaction response can't be fetched.

import type { PublicKey } from "@solana/web3.js";
/** `reference` in the [Solana Actions spec](https://github.com/solana-labs/solana-pay/blob/master/SPEC.md#reference). */
export type { ActionError, ActionGetRequest, ActionsJson, ActionGetResponse, LinkedAction, ActionPostRequest, ActionPostResponse, ActionParameter, ActionRuleObject, SupportedProtocols, SOLANA_PAY_PROTOCOL, SOLANA_ACTIONS_PROTOCOL, } from "@solana/actions-spec";
/** `reference` in the [Solana Pay spec](https://github.com/solana-labs/solana-pay/blob/master/SPEC.md#reference). */
export declare type Reference = PublicKey;
/** `memo` in the [Solana Actions spec](https://github.com/solana-labs/solana-pay/blob/master/SPEC.md#memo). */
/** `memo` in the [Solana Pay spec](https://github.com/solana-labs/solana-pay/blob/master/SPEC.md#memo). */
export declare type Memo = string;
/**
*
*/
export interface ActionsJson {
rules: ActionRuleObject[];
}
/**
*
*/
export interface ActionRuleObject {
/** relative (preferred) or absolute path to perform the rule mapping from */
pathPattern: string;
/** relative (preferred) or absolute path that supports Action requests */
apiPath: string;
}
/**
* Fields of a Solana Action transaction request URL.

@@ -41,77 +27,2 @@ */

}
/** */
/**
* # Reserved for future use
*
* Response body payload sent via the Action GET Request
*/
export interface ActionGetRequest {
}
/**
* Response body payload returned from the Action GET Request
*/
export interface ActionGetResponse {
/** image url that represents the source of the action request */
icon: string;
/** describes the source of the action request */
title: string;
/** brief summary of the action to be performed */
description: string;
/** button text rendered to the user */
label: string;
/** UI state for the button being rendered to the user */
disabled?: boolean;
/** */
links?: {
/** list of related Actions a user could perform */
actions: LinkedAction[];
};
/** non-fatal error message to be displayed to the user */
error?: ActionError;
}
/**
* Related action on a single endpoint
*/
export interface LinkedAction {
/** URL endpoint for an action */
href: string;
/** button text rendered to the user */
label: string;
/** parameters used to accept user input within an action */
parameters?: ActionParameter[];
}
/**
* Parameter to accept user input within an action
*/
export interface ActionParameter {
/** parameter name in url */
name: string;
/** placeholder text for the user input field */
label?: string;
/** declare if this field is required (defaults to `false`) */
required?: boolean;
}
/**
* Response body payload sent via the Action POST Request
*/
export interface ActionPostRequest {
/** base58-encoded public key of an account that may sign the transaction */
account: string;
}
/**
* Response body payload returned from the Action POST Request
*/
export interface ActionPostResponse {
/** base64 encoded serialized transaction */
transaction: string;
/** describes the nature of the transaction */
message?: string;
}
/**
*
*/
export interface ActionError {
/** non-fatal error message to be displayed to the user */
message: string;
}
//# sourceMappingURL=types.d.ts.map
{
"name": "@solana/actions",
"version": "1.1.2",
"version": "1.2.0",
"author": "Solana Maintainers <maintainers@solana.foundation>",

@@ -40,3 +40,2 @@ "repository": "https://github.com/solana-developers/solana-actions",

"watch": "tsc --build --verbose --watch tsconfig.all.json",
"release": "npm run clean && npm run build",
"prettier": "prettier --write '{*,**/*}.{ts,tsx,js,jsx,css,json}'",

@@ -48,5 +47,9 @@ "lint": "prettier --check '{*,**/*}.{ts,tsx,js,jsx,css,json}' && eslint --max-warnings 0 .",

"docs": "shx rm -rf docs && npx typedoc && shx cp .nojekyll docs/",
"deploy:docs": "npm run docs && npx gh-pages --dist docs/ --dotfiles"
"deploy:docs": "npm run docs && npx gh-pages --dist docs/ --dotfiles",
"version": "changeset version && git add -A && git commit -m \"chore: version\"",
"release": "npm run clean && npm run build",
"publish": "npm run release && changeset publish && git add -A && git push --follow-tags && npm run deploy:docs"
},
"dependencies": {
"@solana/actions-spec": "^2.0.0",
"@solana/qr-code-styling": "^1.6.0",

@@ -53,0 +56,0 @@ "@solana/web3.js": "^1.61.0",

@@ -12,8 +12,9 @@ import {

import type { Reference } from "./types.js";
import { MEMO_PROGRAM_ID, SOLANA_ACTIONS_PROTOCOL } from "./constants.js";
import { MEMO_PROGRAM_ID } from "./constants.js";
import { findReference } from "./findReference.js";
import { SOLANA_ACTIONS_PROTOCOL } from "@solana/actions-spec";
const ACTIONS_IDENTITY_SCHEMA = {
separator: ":",
protocol: SOLANA_ACTIONS_PROTOCOL.replace(":", ""),
protocol: ("solana-action:" as SOLANA_ACTIONS_PROTOCOL).replace(":", ""),
/** avoids magic numbers */

@@ -20,0 +21,0 @@ scheme: {

/** @internal */
export const SOLANA_PAY_PROTOCOL = "solana:";
/** @internal */
export const SOLANA_ACTIONS_PROTOCOL = "solana-action:";
/** @internal */
export const SOLANA_ACTIONS_PROTOCOL_PLURAL = "solana-actions:";
/** @internal */
export const HTTPS_PROTOCOL = "https:";

@@ -12,0 +3,0 @@

import { Commitment, PublicKey, Signer } from "@solana/web3.js";
import { Transaction } from "@solana/web3.js";
import { ActionPostResponse, Reference } from "./types.js";
import type { Reference } from "./types.js";
import { MEMO_PROGRAM_ID } from "./constants.js";

@@ -9,2 +9,3 @@ import {

} from "./actionIdentity.js";
import { ActionPostResponse } from "@solana/actions-spec";

@@ -11,0 +12,0 @@ /**

@@ -1,7 +0,4 @@

import { BLINKS_QUERY_PARAM, SOLANA_ACTIONS_PROTOCOL } from "./constants.js";
import type {
ActionRequestURLFields,
BlinkURLFields,
SupportedProtocols,
} from "./types.js";
import { SupportedProtocols } from "@solana/actions-spec";
import { BLINKS_QUERY_PARAM } from "./constants.js";
import type { ActionRequestURLFields, BlinkURLFields } from "./types.js";

@@ -24,3 +21,3 @@ /**

fields: ActionRequestURLFields | BlinkURLFields,
protocol: SupportedProtocols = SOLANA_ACTIONS_PROTOCOL,
protocol: SupportedProtocols = "solana-action:",
): URL {

@@ -33,3 +30,3 @@ if ("blink" in fields) return encodeBlinkURL(fields, protocol);

{ link, label, message }: ActionRequestURLFields,
protocol: SupportedProtocols = SOLANA_ACTIONS_PROTOCOL,
protocol: SupportedProtocols = "solana-action:",
): URL {

@@ -36,0 +33,0 @@ // Remove trailing slashes

@@ -0,1 +1,2 @@

import { ActionPostRequest, ActionPostResponse } from "@solana/actions-spec";
import { Commitment, Connection, PublicKey } from "@solana/web3.js";

@@ -6,3 +7,2 @@ import { Transaction } from "@solana/web3.js";

import nacl from "tweetnacl";
import { ActionPostRequest, ActionPostResponse } from "./types.js";

@@ -9,0 +9,0 @@ /**

@@ -1,8 +0,3 @@

import {
BLINKS_QUERY_PARAM,
HTTPS_PROTOCOL,
SOLANA_ACTIONS_PROTOCOL,
SOLANA_ACTIONS_PROTOCOL_PLURAL,
SOLANA_PAY_PROTOCOL,
} from "./constants.js";
import type { SupportedProtocols } from "@solana/actions-spec";
import { BLINKS_QUERY_PARAM, HTTPS_PROTOCOL } from "./constants.js";
import type { ActionRequestURLFields, BlinkURLFields } from "./types.js";

@@ -36,7 +31,5 @@

if (
url.protocol !== SOLANA_PAY_PROTOCOL &&
url.protocol !== SOLANA_ACTIONS_PROTOCOL &&
url.protocol !== SOLANA_ACTIONS_PROTOCOL_PLURAL
) {
const protocol = url.protocol as SupportedProtocols;
if (protocol !== "solana:" && protocol !== "solana-action:") {
throw new ParseURLError("protocol invalid");

@@ -43,0 +36,0 @@ }

import type { PublicKey } from "@solana/web3.js";
import {
// re-export all types from the Actions spec
export type {
ActionError,
ActionGetRequest,
ActionsJson,
ActionGetResponse,
LinkedAction,
ActionPostRequest,
ActionPostResponse,
ActionParameter,
ActionRuleObject,
SupportedProtocols,
SOLANA_PAY_PROTOCOL,
SOLANA_ACTIONS_PROTOCOL,
SOLANA_ACTIONS_PROTOCOL_PLURAL,
SOLANA_PAY_PROTOCOL,
} from "./constants.js";
} from "@solana/actions-spec";
/** `reference` in the [Solana Actions spec](https://github.com/solana-labs/solana-pay/blob/master/SPEC.md#reference). */
/** `reference` in the [Solana Pay spec](https://github.com/solana-labs/solana-pay/blob/master/SPEC.md#reference). */
export type Reference = PublicKey;
/** `memo` in the [Solana Actions spec](https://github.com/solana-labs/solana-pay/blob/master/SPEC.md#memo). */
/** `memo` in the [Solana Pay spec](https://github.com/solana-labs/solana-pay/blob/master/SPEC.md#memo). */
export type Memo = string;
/** @internal */
export type SupportedProtocols =
| typeof SOLANA_ACTIONS_PROTOCOL
| typeof SOLANA_PAY_PROTOCOL
| typeof SOLANA_ACTIONS_PROTOCOL_PLURAL;
/**
*
*/
export interface ActionsJson {
rules: ActionRuleObject[];
}
/**
*
*/
export interface ActionRuleObject {
/** relative (preferred) or absolute path to perform the rule mapping from */
pathPattern: string;
/** relative (preferred) or absolute path that supports Action requests */
apiPath: string;
}
/**
* Fields of a Solana Action transaction request URL.

@@ -58,83 +46,1 @@ */

}
/** */
/**
* # Reserved for future use
*
* Response body payload sent via the Action GET Request
*/
export interface ActionGetRequest {}
/**
* Response body payload returned from the Action GET Request
*/
export interface ActionGetResponse {
/** image url that represents the source of the action request */
icon: string;
/** describes the source of the action request */
title: string;
/** brief summary of the action to be performed */
description: string;
/** button text rendered to the user */
label: string;
/** UI state for the button being rendered to the user */
disabled?: boolean;
/** */
links?: {
/** list of related Actions a user could perform */
actions: LinkedAction[];
};
/** non-fatal error message to be displayed to the user */
error?: ActionError;
}
/**
* Related action on a single endpoint
*/
export interface LinkedAction {
/** URL endpoint for an action */
href: string;
/** button text rendered to the user */
label: string;
/** parameters used to accept user input within an action */
parameters?: ActionParameter[];
}
/**
* Parameter to accept user input within an action
*/
export interface ActionParameter {
/** parameter name in url */
name: string;
/** placeholder text for the user input field */
label?: string;
/** declare if this field is required (defaults to `false`) */
required?: boolean;
}
/**
* Response body payload sent via the Action POST Request
*/
export interface ActionPostRequest {
/** base58-encoded public key of an account that may sign the transaction */
account: string;
}
/**
* Response body payload returned from the Action POST Request
*/
export interface ActionPostResponse {
/** base64 encoded serialized transaction */
transaction: string;
/** describes the nature of the transaction */
message?: string;
}
/**
*
*/
export interface ActionError {
/** non-fatal error message to be displayed to the user */
message: string;
}

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

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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc