[ { "url": "https://docs.dialect.to/documentation", "title": "Introduction | Actions & Alerts", "content": "Introduction\nActions\n\nActions and Blinks are an ambitious new protocol in collaboration with Solana—& a developer stack by Dialect—to share Solana transactions everywhere.\n\nActions are a protocol for creating & delivering Solana transactions through URLs, making Solana sharable everywhere. Blinks, or Blockchain Links, are clients that detect Action URLs & unfurl them into full experiences.\n\nBlinks are like Link Previews with interactive capabilities.\n\nWe've teamed up with Solana's leading wallets to bring Actions and Blinks right to Twitter, with native support in Phantom, Backpack, and soon in Solflare. You can try them out today by enabling Blinks from your favorite wallet: ⚙️ → Enable Actions/Blinks.\n\nOr try Dialect's dedicated Blinks Chrome extension.\n\nSolana's top teams are building with Actions today.\n\nThese docs describe the Actions Specification, how Blinks work to unfurl Actions APIs, and provide practical resources on how to get started developing today.\n\nAlerts\n\nDialect powers alerts for many of Solana's most loved projects. All of our tooling is open source and free to use. Get started and send your first test alert in under 15 minutes.\n\nSee the Getting started section for more information.\n\nNext\nActions\n\nLast updated 1 month ago" }, { "url": "https://docs.dialect.to/documentation/actions", "title": "Actions | Actions & Alerts", "content": "Actions\n\nActions are APIs that deliver signable transactions, and soon signable messages.\n\nBlockchain links, or Blinks, are clients that determine if URLs conform to the Actions spec, & introspect the underlying Actions APIs to construct interfaces for them.\n\nAny client that fully introspects an Actions API to build a complete interface for it is a Blink. Therefore, not all clients that consume Actions APIs are Blinks.\n\nActions are hosted at URLs, and are therefore sharable by their URL.\n\nActions are comprised of URL scheme, a GET route, and a POST route to the Action Provider:\n\nA URL scheme for identifying Actions Providers\n\nA GET request and response, to and from, an action URL, for presenting the client with human-readable information.\n\nA POST request and response, to and from an action URL, for constructing transactions (and soon messages) for signing and submission to the blockchain.\n\nThis documentation covers:\n\nthe Actions specification,\n\nhow the specification relates to blinks, as well as\n\nmore practical guides on how to build actions and\n\nhow to build blinks clients, whether natively into a web or mobile dapp, or via a Chrome extension for delivery on 3rd party sites like Twitter, and\n\nmaterials on Security and the Public Registry.\n\nLet's get started.\n\nPrevious\nIntroduction\nNext\nQuick Start\n\nLast updated 10 days ago" }, { "url": "https://docs.dialect.to/documentation/actions/quick-start", "title": "Quick Start | Actions & Alerts", "content": "These docs cover the Actions and Blinks specifications and how they work. For a more practical guide on creating your first action, testing and deploying it, and getting it ready to use on Twitter, see the Guide below.\nIf you're interested in building a Blinks client, see the Guide on building Blinks.\n Last updated 24 days ago \nWas this helpful?" }, { "url": "https://docs.dialect.to/documentation/actions/specification", "title": "Specification | Actions & Alerts", "content": "Specification\n\nThis section of the docs describes the Actions Specification, including aspects of the specification that concern Blinks. Namely, it covers\n\nURL Schemes\n\nGET & POST schemas and capabilities\n\nOPTIONS request and CORS handling\n\nExecution and lifecycle\n\nMulti-actions and action input types\n\nThe role of actions.json in upgrading website URLs with Blinks capabilities\n\nAspects of Blinks that are concerned with the Actions specification.\n\nFor more practical guides, see Actions and Blinks.\n\nPrevious\nQuick Start\nNext\nURL Scheme\n\nLast updated 9 days ago" }, { "url": "https://docs.dialect.to/documentation/actions/specification/url-scheme", "title": "URL Scheme | Actions & Alerts", "content": "URL Scheme\n\nSolana Actions conform to a URL scheme denoted by solana-action:. They are a set of standard, interactive HTTP requests for constructing transactions or messages for the client to sign with a wallet keypair.\n\nCopy\nsolana-action:\n\nThe link field must be a conditionally URL-encoded absolute HTTPS URL.\n\nThe URL may contain URL-encoded query parameters, which will prevent conflicts with any potential Actions protocol parameters added via the protocol specification.\n\nThe URL does not need to be URL-encoded if it does not contain any query parameters.\n\nClients are responsible for decoding the URL, and if unsuccessful, should reject the action as malformed.\n\nPrevious\nSpecification\nNext\nGET\n\nLast updated 1 month ago", "code_snippets": ["solana-action:"] }, { "url": "https://docs.dialect.to/documentation/actions/specification/post", "title": "POST | Actions & Alerts", "content": "POST\nPOST Request\n\nActions support HTTP POST JSON requests to their URL with the the body payload:\n\nCopy\n{\n\n \"account\": \"\"\n\n}\n\nwhere account is a base58-encoded representation of the public key of the user making the request.\n\nClients should use Accept-Encoding headers and the Action service should respond with a Content-Encoding header for HTTP compression.\n\nPost Response\n\nActions services should respond to POST requests with an HTTP OK JSON response with a payload of the format below.\n\nCopy\nexport interface ActionPostResponse {\n\n /** base64-encoded transaction */\n\n transaction: string;\n\n /** optional message, can be used to e.g. describe the nature of the transaction */\n\n message?: string;\n\n}\n\nThe client must handle HTTP client errors, server errors, and redirect responses.\n\nThe endpoint should respond with a Content-Type header of application/json.\n\nAction Chaining [Upcoming]\n\nThe following specification is not supported by Dialect's Blinks Client. We're working on bringing Client support as soon as possible.\n\nIn the next few weeks, the Dialect Blinks Client will be rolling out support for Action Chaining, which allows the confirmation of an action on-chain to present the context of a new action to the user, constructing what is essentially a 'chain' of actions in a successive series. \n\nThe changes to the specification to enable action chaining are:\n\nCopy\nexport interface ActionPostResponse {\n\n /** base64 encoded serialized transaction */\n\n transaction: string;\n\n /** describes the nature of the transaction */\n\n message?: string;\n\n links?: {\n\n /**\n\n * The next action in a successive chain of actions to be obtained after\n\n * the previous was successful.\n\n */\n\n next: NextActionLink;\n\n };\n\n}\n\n\n\nexport type NextActionLink = PostNextActionLink | InlineNextActionLink;\n\n\n\n/** @see {NextActionPostRequest} */\n\nexport interface PostNextActionLink {\n\n /** Indicates the type of the link. */\n\n type: \"post\";\n\n /** Relative or same origin URL to which the POST request should be made. */\n\n href: string;\n\n}\n\n\n\n/**\n\n * Represents an inline next action embedded within the current context.\n\n */\n\nexport interface InlineNextActionLink {\n\n /** Indicates the type of the link. */\n\n type: \"inline\";\n\n /** The next action to be performed */\n\n action: NextAction;\n\n}\n\nTo chain multiple actions together, in any ActionPostResponse include a links.next of either\n\nPostNextActionLink - POST request link with a same origin callback url to receive the signature and user's account in the body. This callback url should respond with a NextAction.\n\nInlineNextActionLink - Inline metadata for the next action to be presented to the user immediately after the transaction has confirmed. No callback will be made.\n\nAfter the ActionPostResponse included transaction is signed by the user and confirmed on-chain, the blink client should either:\n\nexecute the callback request to fetch and display the NextAction, or\n\nif a NextAction is already provided via links.next, the blink client should update the displayed metadata and make no callback request\n\nIf the callback url is not the same origin as the initial POST request, no callback request should be made. Blink clients should display an error notifying the user.\n\nCopy\n/** The next action to be performed */\n\nexport type NextAction = Action<\"action\"> | CompletedAction;\n\n\n\n/** The completed action, used to declare the \"completed\" state within action chaining. */\n\nexport type CompletedAction = Omit, \"links\">;\n\nBased on the type, the next action should be presented to the user via blink clients in one of the following ways:\n\naction - (default) A standard action that will allow the user to see the included Action metadata, interact with the provided LinkedActions, and continue to chain any following actions.\n\ncompleted - The terminal state of an action chain that can update the blink UI with the included Action metadata, but will not allow the user to execute further actions.\n\nIf no links.next is not provided, blink clients should assume the current action is final action in the chain, presenting their \"completed\" UI state after the transaction is confirmed.\n\nPrevious\nGET\nNext\nOPTIONS & CORS\n\nLast updated 1 day ago", "code_snippets": ["{account: }", "export interface ActionPostResponse {/** base64-encoded transaction */transaction: string;/** optional message, can be used to e.g. describe the nature of the transaction */message?: string;}", "export interface ActionPostResponse {transaction: string;message?: string;links?: {next: NextActionLink;};}export type NextActionLink = PostNextActionLink | InlineNextActionLink;export interface PostNextActionLink {type: post;href: string;}export interface InlineNextActionLink {type: inline;action: NextAction;}" ] }, { "url": "https://docs.dialect.to/documentation/actions/specification/options-and-cors", "title": "OPTIONS & CORS | Actions & Alerts", "content": "OPTIONS & CORS\n\nTo enable Cross-Origin Resource Sharing (CORS) for Actions clients (including blinks), all Action endpoints must handle HTTP OPTIONS requests with appropriate headers. This ensures clients can successfully pass CORS checks for all subsequent requests from the same origin domain.\n\nAn Actions client may perform 'preflight' requests to the Action URL endpoint in the form of an OPTIONS HTTP method to check if the GET request will pass all CORS checks. The OPTIONS method should respond with all the required HTTP headers to allow clients (like blinks) to properly make all the subsequent requests from the origin domain.\n\nThe minimum required HTTP headers are:\n\nAccess-Control-Allow-Origin with a value of *\n\nAccess-Control-Allow-Methods with a value of GET,POST,PUT,OPTIONS\n\nAccess-Control-Allow-Headers with a minimum value of Content-Type, Authorization, Content-Encoding, Accept-Encoding\n\nCORS Headers for Actions.json\n\nThe actions.json file response must also return valid CORS headers for GET and OPTIONS requests as noted in the actions.json section of these docs\n\nPrevious\nPOST\nNext\nExecution & Lifecycle\n\nLast updated 11 days ago" }, { "url": "https://docs.dialect.to/documentation/actions/specification/get", "title": "GET | Actions & Alerts", "content": "GET\nRequest\n\nAction clients first make an HTTP GET JSON request to the Action URL. The request should be made with an Accept-Encoding header.\n\nResponse\n\nThe Action URL should respond with an HTTP OK JSON response with the body payload below, or with an HTTP error.\n\nThe client must handle HTTP client errors, server errors, and redirect responses.\n\nThe endpoint should respond with a Content-Encoding header for HTTP compression.\n\nThe client should not cache the response except as instructed by HTTP caching response headers.\n\nThe client should then display the response body information, like icon, title, description, and labels.\n\nGET Response Body\n\nA successful GET response with status HTTP OK should conform to the following payload:\n\nCopy\nexport interface ActionGetResponse {\n\n /** url of some descriptive image for the action */\n\n icon: string;\n\n /** title of the action */\n\n title: string;\n\n /** brief description of the action */\n\n description: string;\n\n /** text to be rendered on the action button */\n\n label: string;\n\n /** optional state for disabling the action button(s) */\n\n disabled?: boolean;\n\n /** optional list of related Actions */\n\n links?: {\n\n actions: LinkedAction[];\n\n };\n\n /** optional (non-fatal) error message */\n\n error?: ActionError;\n\n}\n\nicon - Must be an absolute HTTP or HTTPS URL of an image describing the action. Supported image formats are SVG, PNG, or WebP image. If none of the above, the client ust reject it as malformed.\n\ntitle - A UTF-8 string for the title of the action.\n\ndescription - A UTF-8 string providing a brief description of the action.\n\nlabel - AUTF-8 string to be displayed on the button used to execute the action. Labels should not exceed 5 word phrases and should start with a verb, to emphasize the action to be taken. For example, \"Mint NFT\", \"Vote Yes\", or \"Stake 1 SOL\".\n\ndisabled - An optional boolean value. If present, all buttons associated with the action should be disabled. This optional value is falsey, in that its absence is equivalent to enabled=true. Examples of disabled in use could include an NFT collection that has minted out, or a governance proposal whose voting period as ended.\n\nerror - An optional error indication for non-fatal errors, intended to be human readable and presented to the end-user. If set, it should not prevent the client from interpreting the action or displaying it to the user. For example, the error can be used together with disabled to display a reason like business constraints, authorization, the state, or an error of external resource.\n\nCopy\nexport interface ActionError {\n\n /** non-fatal error message to be displayed to the user */\n\n message: string;\n\n}\n\nlinks.actions - An optional array of addtional actions related to this action. Each linked action is given only a label, to be rendered on a button, and an associated Action URL at href. No additional icons, titles, or descriptions are provided. For example, a governance vote action endpoint may return three options for the user: \"Vote Yes\", \"Vote No\", and \"Abstain from Vote\".\n\nIf no links.actions is provided, the client should render a single button using the root label string and make the POST request to the same action URL endpoint as the initial GET request.\n\nIf any links.actions are provided, the client should only render buttons and input fields based on the items listed in the links.actions field. The client should not render a button for the contents of the root label.\n\nCopy\nexport interface LinkedAction {\n\n /** URL endpoint for an action */\n\n href: string;\n\n /** button text rendered to the user */\n\n label: string;\n\n /**\n\n * Parameters to accept user input within an action\n\n * @see {ActionParameter}\n\n * @see {ActionParameterSelectable}\n\n */\n\n parameters?: Array;\n\n}\n\n\n\n/** Parameter to accept user input within an action */\n\nexport interface ActionParameter {\n\n /** input field type */\n\n type?: ActionParameterType;\n\n /** parameter name in url */\n\n name: string;\n\n /** placeholder text for the user input field */\n\n label?: string;\n\n /** declare if this field is required (defaults to `false`) */\n\n required?: boolean;\n\n /** regular expression pattern to validate user input client side */\n\n pattern?: string;\n\n /** human-readable description of the `type` and/or `pattern`, represents a caption and error, if value doesn't match */\n\n patternDescription?: string;\n\n /** the minimum value allowed based on the `type` */\n\n min?: string | number;\n\n /** the maximum value allowed based on the `type` */\n\n max?: string | number;\n\n}\n\nNote that the complete ActionParameter interface is not supported by Blinks clients, and we're working on bringing client support as soon as possible. As of now, the fields in ActionParameter that are supported are name, label and required. ActionParameterSelectable is not currently supported as well. \n\nNote that ActionParameter represents a second action type, one with a multiple input types, as well as an extended version of ActionParameter called ActionParameterSelectable which are expanded on in Action Types.\n\nFor more information on how actions are linked to create multi-action experiences, see Multi-Actions.\n\nExamples\n\nExample GET Response\n\nThe following example response provides a single \"root\" action that is expected to be presented to the user a single button with a label of \"Buy WIF\":\n\nCopy\n{\n\n \"title\": \"Buy WIF with SOL\",\n\n \"icon\": \"\",\n\n \"description\": \"Buy WIF using SOL. Choose a USD amount of SOL from the options below.\",\n\n \"label\": \"Buy WIF\" // button text\n\n}\n\nThe following example response provides 3 related action links that allow the user to click one of 3 buttons to buy WIF:\n\nCopy\n{\n\n \"title\": \"Buy WIF with SOL\",\n\n \"icon\": \"\",\n\n \"description\": \"Buy WIF using SOL. Choose a USD amount of SOL from the options below.\",\n\n \"label\": \"Buy WIF\",\n\n \"links\": {\n\n \"actions\": [\n\n {\n\n \"label\": \"$10\", // button text\n\n \"href\": \"/api/buy?amount=10\"\n\n },\n\n {\n\n \"label\": \"$100\", // button text\n\n \"href\": \"/api/buy?amount=100\"\n\n },\n\n {\n\n \"label\": \"$1,000\", // button text\n\n \"href\": \"/api/buy?amount=1000\"\n\n }\n\n ]\n\n }\n\n}\n\nExample GET Response with Parameters\n\nThe following examples response demonstrate how to accept text input from the user (via parameters) and include that input in the final POST request endpoint (via the href field within a LinkedAction):\n\nThe following example response provides the user with 3 linked actions to buy WIF: a button labeled \"$10\", another button labeled \"$100\", a third button labeled \"$1,000\" and a text input field that allows the user to enter a specific \"amount\" value that will be sent to the Action API:\n\nCopy\n{\n\n \"title\": \"Buy WIF with SOL\",\n\n \"icon\": \"\",\n\n \"description\": \"Buy WIF using SOL. Choose a USD amount of SOL from the options below, or enter a custom amount.\",\n\n \"label\": \"Buy WIF\", // not displayed since `links.actions` are provided\n\n \"links\": {\n\n \"actions\": [\n\n {\n\n \"label\": \"$10\", // button text\n\n \"href\": \"/api/buy?amount=10\"\n\n // no `parameters` therefore not a text input field\n\n },\n\n {\n\n \"label\": \"$100\", // button text\n\n \"href\": \"/api/buy?amount=100\"\n\n // no `parameters` therefore not a text input field\n\n },\n\n {\n\n \"label\": \"$1,000\", // button text\n\n \"href\": \"/api/buy?amount=1000\"\n\n // no `parameters` therefore not a text input field\n\n },\n\n {\n\n \"label\": \"Buy WIF\", // button text\n\n \"href\": \"/api/buy?amount={amount}\",\n\n \"parameters\": [\n\n {\n\n \"name\": \"amount\", // field name\n\n \"label\": \"Enter a custom USD amount\" // text input placeholder\n\n }\n\n ]\n\n }\n\n ]\n\n }\n\n}\n\nThe following example response provides a single input field for the user to enter an amount which is sent with the POST request (either as a query parameter or a subpath can be used):\n\nCopy\n{\n\n \"icon\": \"\",\n\n \"label\": \"Buy WIF\",\n\n \"title\": \"Buy WIF with SOL\",\n\n \"description\": \"Buy WIF using SOL. Choose a USD amount of SOL from the options below, or enter a custom amount.\",\n\n \"links\": {\n\n \"actions\": [\n\n {\n\n \"label\": \"Buy WIF\", // button text\n\n \"href\": \"/api/buy/{amount}\", // or /api/buy?amount={amount}\n\n \"parameters\": [\n\n // {amount} input field\n\n {\n\n \"name\": \"amount\", // input field name\n\n \"label\": \"Enter a custom USD amount\" // text input placeholder\n\n }\n\n ]\n\n }\n\n ]\n\n }\n\n}\n\nNote that the aspect ratio of the url-to-image is generally flexible and the only limitation is that the max height of the image must be equal to the max width of the blink container. The recommended size for 1:1 aspect ratio is 440px x 440px \n\nPrevious\nURL Scheme\nNext\nPOST\n\nLast updated 13 hours ago", "code_snippets": ["{title: Buy WIF with SOLicon: description: Buy WIF using SOL. Choose a USD amount of SOL from the options below.label: Buy WIF}", "{title: Buy WIF with SOLicon: ,description: Buy WIF using SOL. Choose a USD amount of SOL from the options below.,label: Buy WIF,links: {actions: [{label: $10, href: /api/buy?amount=10},{label: $100,href: /api/buy?amount=100},{label: $1,000, href: /api/buy?amount=1000}]}}", "{title: Buy WIF with SOL,icon: ,description: Buy WIF using SOL. Choose a USD amount of SOL from the options below, or enter a custom amount.,label: Buy WIF,links: {actions: [{label: $10,href: /api/buy?amount=10},{label: $100,href: /api/buy?amount=100},{label: $1,000,href: /api/buy?amount=1000},{label: Buy WIF, href: /api/buy?amount={amount},parameters: [{name: amount,label: Enter a custom USD amount}]}]}}", "{icon: ,label: Buy WIF,title: Buy WIF with SOL,description: Buy WIF using SOL. Choose a USD amount of SOL from the options below, or enter a custom amount.,links: {actions: [{label: Buy WIF,href: /api/buy/{amount},parameters: [{name: amount,label: Enter a custom USD amount}]}]}}", "export interface ActionGetResponse {icon: string;title: string;description: string;label: string;disabled?: boolean;links?: {actions: LinkedAction[];};error?: ActionError;}", "export interface ActionError {message: string;}", "export interface LinkedAction {href: string;label: string;parameters?: Array;}export interface ActionParameter {type?: ActionParameterType;name: string;label?: string;required?: boolean;pattern?: string;patternDescription?: string;min?: string | number;max?: string | number;}"] }, { "url": "https://docs.dialect.to/documentation/actions/specification/execution-and-lifecycle", "title": "Execution & Lifecycle | Actions & Alerts", "content": "Execution & Lifecycle\n\nWe've describe the URL scheme, as well as the GET and POST APIs. Let's now describe the full Action execution flow, which follows a typical HTTP REST API lifecycle:\n\nThe client makes a GET request to the Action URL.\n\nThe Action API returns a GET response body of human-readable metadata describing the actions at this URL, according to the specification above.\n\nThe end-user chooses an action to take from the options available, and the client makes a POST request to the server at the specified URL, either the same as the GET URL, or different.\n\nThe Action Provider receives this request, constructs a transaction (or soon message) that constitutes the action to be taken by the end-user, and returns a POST response body containing this transaction.\n\nThe client takes this transaction and prepares it for the end-user to sign by sending it to a client-side wallet such as a chrome extension or embedded wallet.\n\nThe user signs the transaction (or soon message), and the client handles submission of this transaction to the blockchain.\n\nValidation\n\nActions providers support validation. GET and POST requests may first validate whether the action is able to be taken, and may customize their response metadata, and use disabled if validation fails.\n\nFor example, GET requests for a NFT that is up for auction may return an error message “This auction has completed” and render the “Bid” button as disabled . Or a GET request for a vote for a DAO governance proposal whose voting window has closed may return the error message “This proposal is no longer up for a vote” and the Vote yes & Vote no buttons as “disabled”.\n\nExecution\n\nOnce signed, transactions are submitted to the blockchain, and the client is responsible for tracking the execution lifecycle.\n\nPersistence\n\nActions do not persist their execution state beyond a single session. If a user refreshes the client, or leaves and comes back at a later time, past or current interactions with the Action are no longer reflected by the client.\n\nPrevious\nOPTIONS & CORS\nNext\nMulti-Actions\n\nLast updated 1 month ago" }, { "url": "https://docs.dialect.to/documentation/actions/specification/multi-actions", "title": "Multi-Actions | Actions & Alerts", "content": "Multi-Actions\n\nTo support multiple actions, Action Provider GET responses may include additional action URLs via the links attribute.\n\nCopy\nexport interface LinkedAction {\n\n /** URL endpoint for an action */\n\n href: string;\n\n /** button text rendered to the user */\n\n label: string;\n\n /** Parameter to accept user input within an action */\n\n parameters?: [ActionParameter];\n\n}\n\n\n\n/** Parameter to accept user input within an action */\n\nexport interface ActionParameter {\n\n /** parameter name in url */\n\n name: string;\n\n /** placeholder text for the user input field */\n\n label?: string;\n\n /** declare if this field is required (defaults to `false`) */\n\n required?: boolean;\n\n}\n\nAll of these linked actions are themselves Action URLs at href, and may themselves also return multiple actions.\n\nLinked actions, although valid actions, only provide a label and href as they are are intended to be used to display additional buttons in a single Blink.\n\nSuch examples include “Buy 1 SOL”, “Buy 5 SOL”, “Buy 10 SOL” as options within a single API call or single interface.\n\nLinked actions hrefs support both absolute and relative paths.\n\nThe optional parameters attribute allows for a second action type, which is covered in the next section.\n\nNOTE: If you're looking to create blinks with multiple-input forms like the one below, check out the next section.\n\nSample Multi-Input Form Blink\n\nPrevious\nExecution & Lifecycle\nNext\nAction Types\n\nLast updated 25 days ago", "code_snippets": ["export interface LinkedAction {href: string;label: string;parameters?: [ActionParameter];}export interface ActionParameter {name: string;label?: string;required?: boolean;}"] }, { "url": "https://docs.dialect.to/documentation/actions/specification/actions.json", "title": "actions.json | Actions & Alerts", "content": "" }, { "url": "https://docs.dialect.to/documentation/actions/specification/action-types", "title": "Action Types | Actions & Alerts", "content": "Action Types\n\nLinked Actions support both fixed as well as parameterized values, as specified by the optional parameters attribute.\n\nParameterized actions signal to the client that users may provide a variable input for the action.\n\nApart from simple text input fields, ActionParameter now also accepts other input types as specified in ActionParameterType.\n\nCopy\nexport interface LinkedAction {\n\n /** URL endpoint for an action */\n\n href: string;\n\n /** button text rendered to the user */\n\n label: string;\n\n /**\n\n * Parameters to accept user input within an action\n\n * @see {ActionParameter}\n\n * @see {ActionParameterSelectable}\n\n */\n\n parameters?: Array;\n\n}\n\n\n\n/** Parameter to accept user input within an action */\n\nexport interface ActionParameter {\n\n /** input field type */\n\n type?: ActionParameterType;\n\n /** parameter name in url */\n\n name: string;\n\n /** placeholder text for the user input field */\n\n label?: string;\n\n /** declare if this field is required (defaults to `false`) */\n\n required?: boolean;\n\n /** regular expression pattern to validate user input client side */\n\n pattern?: string;\n\n /** human-readable description of the `type` and/or `pattern`, represents a caption and error, if value doesn't match */\n\n patternDescription?: string;\n\n /** the minimum value allowed based on the `type` */\n\n min?: string | number;\n\n /** the maximum value allowed based on the `type` */\n\n max?: string | number;\n\n}\n\n\n\n/**\n\n * Input field type to present to the user\n\n * @default `text`\n\n */\n\nexport type ActionParameterType =\n\n | \"text\"\n\n | \"email\"\n\n | \"url\"\n\n | \"number\"\n\n | \"date\"\n\n | \"datetime-local\"\n\n | \"checkbox\"\n\n | \"radio\"\n\n | \"textarea\"\n\n | \"select\";\n\n \n\n/**\n\n * note: for ease of reading, this is a simplified type of the actual\n\n */\n\ninterface ActionParameterSelectable extends ActionParameter {\n\n options: Array<{\n\n /** displayed UI label of this selectable option */\n\n label: string;\n\n /** value of this selectable option */\n\n value: string;\n\n /** whether or not this option should be selected by default */\n\n selected?: boolean;\n\n }>;\n\n}\n\nWhen type is set as select, checkbox, or radio then the Action should include an array of options as shown above in ActionParameterSelectable. \n\nAs mentioned in the GET specs, the Blinks Client only supports ActionParameter in the LinkedAction interface, and within ActionParameter, only name, label and required are supported. We're working on bringing complete support as soon as possible\n\nOnly Linked Actions Support Parameters\n\nOnly linked actions support parameters. The Actions Spec extends Solana Pay and must remain interoperable with Solana Pay. As a result, all URLs that may be called via GET requests must also support POST requests. Parameterized actions are underspecified by construction, and therefore signable transactions are not possible via POST routes. \n\nBlinks with Multi-Input Forms\n\nYou can also build a blink with multiple input fields similar to the one in the previous section by a simple change in the structure of the GET response.\n\nThe following example demonstrates how you can structure the GET response to allow two different inputs - a custom SOL amount and a Thank You note. \n\nCopy\n{\n\n icon: '',\n\n label: 'Donate SOL',\n\n title: 'Donate to Alice',\n\n description: 'Cybersecurity Enthusiast | Support my research with a donation.',\n\n links: {\n\n actions: [\n\n {\n\n href: `/api/donate/{${amountParameterName}}/{${thankYouNote}}`,\n\n label: 'Donate',\n\n parameters: [\n\n {\n\n name: amountParameterName,\n\n label: 'Enter a custom SOL amount',\n\n },\n\n {\n\n name: thankYouNote,\n\n label: 'Thank you note',\n\n },\n\n ],\n\n },\n\n ],\n\n },\n\n}\n\nThe Blink would unfurl like this\n\nNOTE: If you have any actions before this action with a label and custom href for predefined amounts of a parameter, it will be ignored when the Blink is unfurled\n\nPrevious\nMulti-Actions\nNext\nactions.json\n\nLast updated 1 day ago" }, { "url": "https://docs.dialect.to/documentation/actions/actions", "title": "Actions | Actions & Alerts", "content": "Actions\n\nVisit Dialect's Dashboard for a step-by-step guide to:\n\nCreate your first Action using open source, forkable examples in our Github.\n\nTest your action on https://dial.to.\n\nRegister your action.\n\nShare your Actions on Twitter, and bring them to life with Blinks support through your favorite extension like Phantom, Backpack, or Dialect's dedicated Blinks extension.\n\nBuilding an Action\n\nActions Providers are just REST APIs, so you can build an Action in any language (JavaScript, TypeScript, Rust, etc.) or any framework (NextJS, Hono, Express, Fastify, etc.) that supports building a REST API. For more details on the Action specification, check out the Specification section of the docs.\n\nIn the next section, we cover developing actions with NextJS, a popular framework for developing APIs. If you'd like examples from more languages, please see our Actions repo on Github, where we have examples developed in more frameworks, such as ExpressJS and Hono.\n\nPrevious\nBlinks\nNext\nBuilding Actions with NextJS\n\nLast updated 13 hours ago" }, { "url": "https://docs.dialect.to/documentation/actions/specification/blinks", "title": "Blinks | Actions & Alerts", "content": "Blinks\n\nThe Actions Spec v1 does not concern itself with visualization or layout, such as image, title, button or input positioning.\n\nThis is the responsibility of Blinks. In this section, we describe how blinks are constructed from actions, aspects of Blinks that are affected by the Actions specification, and other matters of design.\n\nDetecting Actions via URL Schemes\n\nBlinks may be linked to Actions in at least 3 ways:\n\nSharing an explicit Action URL: solana-action://https://actions.alice.com/donate. In this case, only supported clients may render the Blink. There will be no fallback link preview, or site that may be visited outside of the unsupporting client.\n\nSharing a link to a website that is linked to an actions API via an actions.json file on the website root domain.\n\nE.g. https://alice.com/actions.json maps https://alice.com/donate, a website URL at which users can donate to Alice, to API URL e.g. https://actions.alice.com/donate, at which Actions for donating to Alice are hosted.\n\nEmbedding an Action URL in an “interstitial” site or mobile app deep link URL that understands how to parse actions.\n\nE.g. https://dial.to/?action=solana-action:https://actions.alice.com/donate or \nhttps://dial.to/?action=solana-action:https://dial.to/api/donate\n\n\nIf you want to test if your Action URL does indeed unfurl on a Blink, you can paste it into dial.to and it will render the Blink modal. \n\nTesting an action where we included an error\n\nWe've included an Action validation tool in there which will parse your API and check if the GET, POST and OPTIONS requests work as required. (It even checks for CORS errors)\n\nRendering Blinks\n\nClients that support Blinks should take any of the 3 above formats and correctly unfurl the action directly in the client.\n\nFor clients that do not support Blinks, there should be an underlying website. In other words, the browser is the universal fallback.\n\nIf a user taps anywhere on a client that is not an action button or text input field, they should be taken to the underlying site.\n\nOption 1 above is the most basic form, but also the most limiting in that unsupported clients have no way to handle the link.\n\nOption 2 is the most advanced, in that the developer has done work to map some site to some action.\n\nOption 3 on the other hand, is the purest manifestation of the actions technology: it fully decouples the action to be taken (the inner URL) from the client in which it’s taken (the outer URL).\n\nWe cover Option 3 in greater detail in the next section.\n\nLayout\n\nThis section describes how Blinks choose to layout actions based on the types and number of actions returned from an Action API.\n\nIt will be filled in soon.\n\nMulti-action\n\nBlinks should support some combination of the above—multiple actions & at most one user input text field—where there may be multiple actions, & user input.\n\nText fields have a single button associated with them, that requires an input from the user to be clicked. Text fields may not be linked to multiple buttons. (E.g. memo on your vote is not supported by the MVP.)\n\nRender lifecycle\n\nUsers should not have to tap anything to render the current state of an action, including any dynamic content or validation state that may be needed. That state is determined when the action is first rendered on the screen.\n\nChrome extensions bring Blinks to any website\n\nChrome extensions may be used to add Blink support to clients that would not normally support Blinks. E.g. Twitter web may be made to support Blinks if chrome extensions such as Backpack, Sofllare or Phantom integrate Blinks capabilities.\n\nInterstitial \"popup\" sites for Blinks\n\nIn this section we cover Option 3 above in more detail, as it is the pure URL-encoding of the full experience: specifying both an action and the client in which it is to be executed.\n\nCopy\n/?action=solana:\n\nInterstitials—\n\nInterstitial URLs are website or mobile app deep link URLs specifying a client in which to sign for an action. Examples include wallets or other wallet-related applications that are typically responsible for storing keypairs, and that are capable of giving user signing experiences.\n\nhttps://dial.to\n\nhttps://backpack.app\n\nhttps://solflare.com\n\nhttps://phantom.app\n\nhttps://tiplink.io\n\nhttps://fusewallet.com\n\nAny signing client can implement an interstitial site for execution, and developers and users can compose interstitials and actions as they see fit. We describe some examples in the next section.\n\nUser journeys—\n\nAlice is using Jupiter to swap tokens. She chooses the paying & receiving tokens, say SOL & WIF. Near the Swap button is another button she may press, that allows for sharing the action with others.\n\nWhen she presses it, she is presented with a sheet in which she can choose the signing client. It’s a CTA like “Sign with…” and then a grid of well-known wallets or key holding apps like Phantom, Backpack, Solflare, Tiplink, etc.\n\nOnce she chooses one, say Backpack, it copies to her clipboard a URL of the format https://backpack.app/?action=solana:\n\nDetermining interstitials—\n\nNote that in the above example, jup.ag’s interface gives Alice choice for the interstitial, not the blink itself. When Bob taps Alice’s choice for backpack, he is taken to Backpack.\n\n💡 If for example Dialect chose to implement an interstitial-choosing step at https://dialect.to/?action=… —where a user chooses which signing client to use—Backpack, Phantom, etc.—then this is an entirely different abstraction than an interstitial URL, and not a part of the official Blink implementation.\n\nExecution & lifecycle\n\nWhen one action is being taken from a set of available actions, all other actions become un-executable until such time as the current executing action succeeds or fails (incl. timeout).\n\nIn future versions, this may no longer be true, and more flexible experiences may be created.\n\nBlinks do not need to persist their lifecycle beyond the in-the-moment, single user session. If a user refreshes the client, or leaves and comes back at a later time, past or current interactions with the Blink are no longer reflected by the client. This includes not just succeeded actions, but also actions in the middle of execution.\n\nIn future versions, Action and Blink outcomes may persist beyond single-session use.\n\nPrevious\nactions.json\nNext\nActions\n\nLast updated 10 days ago" }, { "url": "https://docs.dialect.to/documentation/actions/actions/building-actions-with-nextjs", "title": "Building Actions with NextJS | Actions & Alerts", "content": "Building Actions with NextJS\n\nIn this section, you'll learn how to build a Solana Action. For the sake of this documentation, we'll be using NextJS to build it.\n\nFor code examples of Actions, check out our code examples or Solana Developers' code examples.\n\nCodebase setup\n\nCreate a Next app through the CLI command and the subsequent setup questions on the CLI\n\nCopy\nnpx create-next-app \n\n\n\ncd \n\nWithin src/app, create a directory called api/actions and within that, create a folder with the name of the action you want to create (eg: api/actions/donate-sol) with a route.ts file. Now, your file directory should look like this: \n\nThe route.ts is the file that has the Action API logic which we're going to look at in a bit.\n\nBefore we dive into the API logic, install the Solana Actions SDK by running the following command:\n\nCopy\n# npm\n\nnpm i @solana/actions\n\n\n\n#yarn\n\nyarn add @solana/actions\n\nImporting the Actions SDK\n\nAt the top of the file, you need to import the following from the @solana/actions SDK:\n\nCopy\nimport {\n\n ActionPostResponse,\n\n ACTIONS_CORS_HEADERS,\n\n createPostResponse,\n\n ActionGetResponse,\n\n ActionPostRequest,\n\n} from \"@solana/actions\";\nStructuring the GET & OPTIONS Request\n\nThe metadata of an Action is returned when a GET request is submitted to the Action API endpoint through a payload. For the complete scope of the payload, check out the GET Request specifications.\n\nThen, the payload is sent in the GET response along with the CORS Headers for it. For more details on why CORS is required, check out the CORS specifications.\n\nThe basic structure of the GET request with the payload is:\n\nCopy\nexport const GET = async (req: Request) => {\n\n const payload: ActionGetResponse = {\n\n title: \"Actions Example - Simple On-chain Memo\",\n\n icon: 'https://ucarecdn.com/7aa46c85-08a4-4bc7-9376-88ec48bb1f43/-/preview/880x864/-/quality/smart/-/format/auto/',\n\n description: \"Send a message on-chain using a Memo\",\n\n label: \"Send Memo\",\n\n };\n\n\n\n return Response.json(payload, {\n\n headers: ACTIONS_CORS_HEADERS,\n\n });\n\n}\n\nThe payload here contains the bare minimum metadata that can be returned by an Action's GET request. The example above is a simple Action for sending a memo transaction to a predefined wallet address.\n\nLinked Actions\n\nThe actions specification allows for multiple actions to be served via a single Action URL. To do this, the payload must include a links field which has a list of actions that are to be included. For further reading into the full scope of the links field, check out the Multi-Actions specifications. \n\nThe payload can be structured in a way that has either - a single input with it's own button, multiple inputs each having their own button to submit a transaction, or multiple inputs with a single button at the bottom to submit a transaction. This is done by varying the structure of the links.actions field\n\nMultiple Inputs - Single Button\nCopy\nconst payload: ActionGetResponse = {\n\n title: 'Donate to Alice',\n\n icon: '',\n\n label: 'Donate SOL',\n\n description: 'Cybersecurity Enthusiast | Support my research with a donation.',\n\n links: {\n\n actions: [\n\n {\n\n href: `/api/donate/{${amountParameterName}}/{${thankYouNote}}`,\n\n label: 'Donate',\n\n parameters: [\n\n {\n\n name: amountParameterName,\n\n label: 'Enter a custom SOL amount',\n\n },\n\n {\n\n name: thankYouNote,\n\n label: 'Thank you note',\n\n },\n\n ],\n\n },\n\n ],\n\n },\n\n}\nMultiple Inputs - Multiple Buttons\nCopy\nconst payload: ActionGetResponse ={\n\n title: 'Donate to Alice',\n\n icon: '',\n\n label: 'Donate SOL',\n\n description: 'Cybersecurity Enthusiast | Support my research with a donation.',\n\n \"links\": {\n\n \"actions\": [\n\n {\n\n \"label\": \"1 SOL\", // button text\n\n \"href\": \"/api/donate?amount=10\"\n\n // no `parameters` therefore not a text input field\n\n },\n\n {\n\n \"label\": \"5 SOL\", // button text\n\n \"href\": \"/api/donate?amount=100\"\n\n // no `parameters` therefore not a text input field\n\n },\n\n {\n\n \"label\": \"10 SOL\", // button text\n\n \"href\": \"/api/donate?amount=1000\"\n\n // no `parameters` therefore not a text input field\n\n },\n\n {\n\n \"label\": \"Donate\", // button text\n\n \"href\": \"/api/donate?amount={amount}\",\n\n \"parameters\": [\n\n {\n\n \"name\": \"amount\", // field name\n\n \"label\": \"Enter a custom SOL amount\" // text input placeholder\n\n }\n\n ]\n\n }\n\n ]\n\n }\n\n};\nOPTIONS request\n\nThe OPTIONS request whose CORS Headers are required for CORS Handling by clients that unfurl Actions is done as follows:\n\nCopy\nexport const OPTIONS = GET;\nPOST request\n\nUsers then execute an Action through a POST request sent to either the Action URL itself or one of the linked Action URLs.\n\nThe body of the POST request contains the wallet address that connects to the client that unfurls the Action and can be derived using the following line of code:\n\nThe basic structure of the POST request with the payload is:\n\nCopy\nexport const POST = async (req: Request) => {\n\n const body: ActionPostRequest = await req.json(); \n\n \n\n // insert transaction logic here \n\n \n\n const payload: ActionPostResponse = await createPostResponse({\n\n fields: {\n\n transaction,\n\n message: \"Optional message to include with transaction\",\n\n },\n\n });\n\n \n\n return Response.json(payload, {\n\n headers: ACTIONS_CORS_HEADERS,\n\n });\n\n};\n\nA transaction to be signed by the user is returned through the payload when a POST request is submitted to the Action API Endpoint. The payload consists of a transaction and an optional message. For the full scope of the POST request and response, check out the full POST specifications\n\nThe transaction included in an Action can be any transaction that can be executed on the Solana blockchain. The most common libraries used for the transaction logic are @solana/web3.js and @metaplex-foundation/umi. \n\nNow, it is fully the responsibility of the client to sign the transaction and submit it to the blockchain. The Dialect Blinks SDK manages the UI unfurling and execution lifecycle of the Action. \n\nFor more examples on building Actions, check out the various open-source examples on our Github, including those for various ecosystem partners like Helius, Jupiter, Meteora, Sanctum and Tensor.\n\nPrevious\nActions\nNext\nBlinks\n\nLast updated 8 days ago", "code_snippets": ["npx create-next-app cd ", "npm i @solana/actions yarn add @solana/actions", "import {ActionPostResponse,ACTIONS_CORS_HEADERS,createPostResponse,ActionGetResponse,ActionPostRequest,} from @solana/actions;", "export const GET = async (req: Request) => {const payload: ActionGetResponse = {title: Actions Example - Simple On-chain Memo,icon: https://ucarecdn.com/7aa46c85-08a4-4bc7-9376-88ec48bb1f43/-/preview/880x864/-/quality/smart/-/format/auto/,description: Send a message on-chain using a Memo,label: Send Memo,};return Response.json(payload, {headers: ACTIONS_CORS_HEADERS,});}", "const payload: ActionGetResponse = {title: Donate to Alice,icon: ,label: Donate SOL,description: Cybersecurity Enthusiast | Support my research with a donation.,links: {actions: [{href: /api/donate/{${amountParameterName}}/{${thankYouNote}},label: Donate,parameters: [{name: amountParameterName,label: Enter a custom SOL amount,},{name: thankYouNote,label: Thank you note,},],},],},}", "const payload: ActionGetResponse ={title: Donate to Alice,icon: ,label: Donate SOL,description: Cybersecurity Enthusiast | Support my research with a donation.,links: {actions: [{label: 1 SOL,href: /api/donate?amount=10},{label: 5 SOL,href: /api/donate?amount=100},{label: 10 SOL,href: /api/donate?amount=1000},{label: Donate, href: /api/donate?amount={amount},parameters: [{name: amount, label: Enter a custom SOL amount}]}]}};", "export const OPTIONS = GET;", "export const POST = async (req: Request) => {const body: ActionPostRequest = await req.json(); const payload: ActionPostResponse = await createPostResponse({fields: {transaction,message: Optional message to include with transaction,},});return Response.json(payload, {headers: ACTIONS_CORS_HEADERS,});};"] }, { "url": "https://docs.dialect.to/documentation/actions/blinks", "title": "Blinks | Actions & Alerts", "content": "Blinks\n\nIn the following sections, you can find how to add native blink support to your dApps through our React SDK, React Native SDK or even adding blink support to 3rd party sites through a Chrome extension.\n\nIf you've built an Action API and want to test the unfurling on an interstitial site, visit our Blinks specification for more details\n\nAdding Blinks to non-React codebases\n\nIf you are interested in adding Blinks, reach out to us on our Discord.\n\nPrevious\nBuilding Actions with NextJS\nNext\nAdd blinks to your web app\n\nLast updated 7 days ago" }, { "url": "https://docs.dialect.to/documentation/actions/blinks/add-blinks-to-3rd-party-sites-via-your-chrome-extension", "title": "Add blinks to 3rd party sites via your Chrome extension | Actions & Alerts", "content": "Add blinks to 3rd party sites via your Chrome extension\n\nThis section is for Chrome extension developers who want to add Blinks to third party sites like Twitter. If you're interested in Native blink support check out our React SDK or React Native SDK.\n\nCopy\n// contentScript.ts\n\nimport { setupTwitterObserver } from \"@dialectlabs/blinks/ext/twitter\";\n\nimport { ActionConfig, ActionContext } from \"@dialectlabs/blinks\";\n\n\n\n// your RPC_URL is used to create a connection to confirm the transaction after action execution\n\nsetupTwitterObserver(new ActionConfig(RPC_URL, {\n\n signTransaction: async (tx: string, context: ActionContext) => { ... },\n\n connect: async (context: ActionContext) => { ... }\n\n}))\n\n\n\n// or\n\n\n\nimport { type ActionAdapter } from \"@dialectlabs/blinks\";\n\n\n\nclass MyActionAdapter implements ActionAdapter {\n\n async signTransaction(tx: string, context: ActionContext) { ... }\n\n async connect(context: ActionContext) { ... }\n\n async confirmTransaction(sig: string, context: ActionContext) { ... }\n\n}\n\n\n\nsetupTwitterObserver(new MyActionAdapter());\nPrevious\nAdd blinks to your mobile app\nNext\nSecurity\n\nLast updated 7 days ago", "code_snippets": ["import { setupTwitterObserver } from @dialectlabs/blinks/ext/twitter;import { ActionConfig, ActionContext } from @dialectlabs/blinks;setupTwitterObserver(new ActionConfig(RPC_URL, {signTransaction: async (tx: string, context: ActionContext) => { ... },connect: async (context: ActionContext) => { ... }}))import { type ActionAdapter } from @dialectlabs/blinks;class MyActionAdapter implements ActionAdapter {async signTransaction(tx: string, context: ActionContext) { ... }async connect(context: ActionContext) { ... }async confirmTransaction(sig: string, context: ActionContext) { ... }}setupTwitterObserver(new MyActionAdapter());"] }, { "url": "https://docs.dialect.to/documentation/actions/blinks/add-blinks-to-your-mobile-app", "title": "Add blinks to your mobile app | Actions & Alerts", "content": "Add blinks to your mobile app\n\nThis section covers adding blinks directly to your React Native dApp through our React Native SDK for blinks. The SDK is completely open-source and can be found in our Github.\n\nInstallation\nCopy\n# npm\n\nnpm i @dialectlabs/blinks @dialectlabs/blinks-react-native\n\n\n\n#yarn\n\nyard add @dialectlabs/blinks @dialectlabs/blinks-react-native\nAdding the Blink Component\n\nThe following imports need to be made to simplify the blink integration\n\nuseAction hook and ActionAdapter type from @dialectlabs/blinks\n\nBlink component from @dialectlabs/blinks-react-native\n\nBasic Usage: \n\nA getWalletAdapter function has to be defined to generate an adapter of type ActionAdapter for interactions with user wallets like wallet connect and signing transactions through the React Native dApp.\n\nAfter that, the component can be used in the React Native dApp to render the blink. It takes the following props:\n\ntheme - has the styling for the blink to be rendered\n\naction - object returned from useAction function (which requires the adapter from getWalletAdapter and Action URL)\n\nwebsiteUrl - the complete URL of the Action\n\nwebsiteText - the domain name of the Action URL\n\nCopy\nimport { useAction, type ActionAdapter } from '@dialectlabs/blinks';\n\nimport { Blink } from '@dialectlabs/blinks-react-native';\n\nimport { PublicKey } from '@solana/web3.js';\n\nimport type React from 'react';\n\n\n\nfunction getWalletAdapter(): ActionAdapter {\n\n return {\n\n connect: async (_context) => {\n\n console.log('connect');\n\n return PublicKey.default.toString();\n\n },\n\n signTransaction: async (_tx, _context) => {\n\n console.log('signTransaction');\n\n return {\n\n signature: 'signature',\n\n };\n\n },\n\n confirmTransaction: async (_signature, _context) => {\n\n console.log('confirmTransaction');\n\n },\n\n };\n\n}\n\n\n\nexport const BlinkInTheWalletIntegrationExample: React.FC<{\n\n url: string; // could be action api or website url\n\n}> = ({ url }) => {\n\n const adapter = getWalletAdapter();\n\n const { action } = useAction({ url, adapter });\n\n\n\n if (!action) {\n\n // return placeholder component\n\n }\n\n const actionUrl = new URL(url);\n\n return (\n\n \n\n );\n\n};\nCustomize Blink Styles\n\nThe blink styles can be customized by passing a theme prop to the Blink component. The theme object can contain any of the following properties:\n\nCopy\n--blink-bg-primary: #202327;\n\n--blink-button: #1d9bf0;\n\n--blink-button-disabled: #2f3336;\n\n--blink-button-success: #00ae661a;\n\n--blink-icon-error: #ff6565;\n\n--blink-icon-primary: #6e767d;\n\n--blink-icon-warning: #ffb545;\n\n--blink-input-bg: #202327;\n\n--blink-input-stroke: #3d4144;\n\n--blink-input-stroke-disabled: #2f3336;\n\n--blink-input-stroke-error: #ff6565;\n\n--blink-input-stroke-selected: #1d9bf0;\n\n--blink-stroke-error: #ff6565;\n\n--blink-stroke-primary: #1d9bf0;\n\n--blink-stroke-secondary: #3d4144;\n\n--blink-stroke-warning: #ffb545;\n\n--blink-text-brand: #35aeff;\n\n--blink-text-button: #ffffff;\n\n--blink-text-button-disabled: #768088;\n\n--blink-text-button-success: #12dc88;\n\n--blink-text-error: #ff6565;\n\n--blink-text-input: #ffffff;\n\n--blink-text-input-disabled: #566470;\n\n--blink-text-input-placeholder: #6e767d;\n\n--blink-text-link: #6e767d;\n\n--blink-text-primary: #ffffff;\n\n--blink-text-secondary: #949ca4;\n\n--blink-text-success: #12dc88;\n\n--blink-text-warning: #ffb545;\n\n--blink-transparent-error: #aa00001a;\n\n--blink-transparent-grey: #6e767d1a;\n\n--blink-transparent-warning: #a966001a;\n\n \n\n--blink-border-radius-rounded-lg: 0.25rem;\n\n--blink-border-radius-rounded-xl: 0.5rem;\n\n--blink-border-radius-rounded-2xl: 1.125rem;\n\n--blink-border-radius-rounded-button: 624.9375rem;\n\n--blink-border-radius-rounded-input: 624.9375rem;\n\nUsing these CSS classes, you can customize the styles to fit the UI of your application.\n\nPrevious\nAdd blinks to your web app\nNext\nAdd blinks to 3rd party sites via your Chrome extension\n\nLast updated 1 day ago", "code_snippets": ["npm i @dialectlabs/blinks @dialectlabs/blinks-react-nativeyard add @dialectlabs/blinks @dialectlabs/blinks-react-native", "import { useAction, type ActionAdapter } from @dialectlabs/blinks;import { Blink } from @dialectlabs/blinks-react-native;import { PublicKey } from @solana/web3.js;import type React from react;function getWalletAdapter(): ActionAdapter {return {connect: async (_context) => {console.log(connect);return PublicKey.default.toString();},signTransaction: async (_tx, _context) => {console.log('signTransaction');return {signature: signature,};},confirmTransaction: async (_signature, _context) => {console.log(confirmTransaction);},};}export const BlinkInTheWalletIntegrationExample: React.FC<{url: string; // could be action api or website url}> = ({ url }) => {const adapter = getWalletAdapter();const { action } = useAction({ url, adapter });if (!action) {}const actionUrl = new URL(url);return ();};"] }, { "url": "https://docs.dialect.to/documentation/actions/security", "title": "Security | Actions & Alerts", "content": "Security\n\nActions and Blinks are a new way to interact with crypto transactions. They present both exciting new opportunities as well as new attack vectors for bad actors. Safety is high priority for this new technology.\n\nAs a public good for the Solana ecosystem, Dialect maintains a public registry — together with the help of Solana Foundation and other community members — of blockchain links that have been verified as non-malicious. As of launch, only Actions that have been registered in the Dialect registry will unfurl in the Twitter feed when posted. Learn how to apply to the Registry here.\n\nIn the near term, the Registry will be managed and hosted at https://dial.to/registry, where developers may register their actions as trusted, and malicious actions will be flagged as blocked.\n\nWhy a new registry is needed\n\nWallet Chrome extensions typically rely on the origin URL of the web page from which a transaction is being created to determine whether that transaction is trustworthy. Actions break this mould, and make it possible, and common, for transactions coming from providers not affiliated with the site.\n\nRegistration status\n\nWallets and other clients using Dialect's Blinks SDK use the registry hosted at https://dial.to/registry to check URLs in the client, and then render Blinks as one of:\n\ntrusted—This action has been registered by the developer and accepted by the registration committee. \n\nblocked—This action has been flagged as malicious by the registration community.\n\nnone—The action has not been registered.\n\nUsers should still take precaution when executing actions, trusted or otherwise. Even trusted actions may cause unintended consequences—the developer may bugs in their action that cause unintended outcomes for users, or their Actions Provider may get compromised by a third party.\n\nRendering Blinks according to Registry status\n\nWallets that use Dialect's Blinks clients will use this registry under the hood to decide how to render Blinks. They have two options:\n\nRender the Blink with the appropriate registry status. Either neutral for trusted, yellow with a warning for unregistered actions with status none, and red for blocked actions known to be malicious.\n\nDon't render blinks of specific registry statuses. \n\nToday, Phantom, Backpack, and all known wallets implementing Blinks clients for sites such as Twitter have chosen to implement option 2. This is because not rendering a Blink that is of status none or blocked is the most conservative thing a Blinks client can do. Neither Phantom, Backpack nor Dialect are in the business of deciding what links users can share on a independent site such as Twitter.\n\nRegister your Action\n\nSubmit your action to the Registry here: https://dial.to/register.\n\nPlease complete the following steps to ensure your submission contains accurate information:\n\nStep 1—Your Action Works ✔️\n\nEnsure your action performs all tasks correctly and reliably. Thoroughly test it to confirm functionality and avoid rejection. You can test your action at dial.to\n\nStep 2—Have a Clear Action Description 📝\n\nProvide a clear, detailed description to expedite the review process. A well-matched description and functionality help reviewers approve your action quickly.\n\nStep 3—Test your Action Thoroughly 🧪\n\nThoroughly test your action in various environments. Consistency and reliability can speed up approval.\n\nStep 4—Build Secure Actions 🔒\n\nAdhere to best security practices to ensure your action is approved. Prioritize security to protect users and gain approval swiftly.\n\nStep 5—Provide a Valid Contact 📞\n\nProvide accurate contact information for smooth follow-ups and verification. Keeping your contacts updated helps prevent delays.\n\nStep 6— Patience 🙏\n\nWe are on a mission to change how experiences are shared on the internet, & are thrilled to have you along for the ride\n\nCurrently registration review is a manual process, however, we are working toward a future automated registration review process.\n\nRegistry schedule\n\nThank you for your patience as we work to better automate and decentralize the Actions registry.\n\nRegistry submissions may be made at any time. Applications will be approved during business hours in various time zones, Monday through Friday.\n\nWork with us on the Registry\n\nDialect believes trust is never something that can be managed by a centralized authority. In the long term, we are working to create a more decentralized, community-driven system for trust. If you're interested in working on this with us, reach out to us in our community Discord.\n\nPrevious\nAdd blinks to 3rd party sites via your Chrome extension\nNext\nThe Blinks Public Registry\n\nLast updated 1 month ago" }, { "url": "https://docs.dialect.to/documentation/actions/the-blinks-public-registry", "title": "The Blinks Public Registry | Actions & Alerts", "content": "The Blinks Public Registry\n\nWe have made our Blinks Public Registry easily accessible through an API endpoint, and in a beautiful new interface on https://dial.to. Running a GET request on the endpoint will return JSON data of all the action APIs that have been submitted, registered and blocked from the registry\n\nThe Blinks Public Registry API can be called from https://registry.dial.to/v1/list.\n\nCopy\ncurl -X GET https://registry.dial.to/v1/list\n\nSending the GET request to this endpoint returns a 200 response with the data in the following format:\n\nCopy\n{\n\n results: Array<{\n\n actionUrl: string;\n\n blinkUrl?: string;\n\n websiteUrl?: string;\n\n createdAt: string;\n\n tags: string[];\n\n }>\n\n}\n\nThe fields within each element of the results array are:\n\nactionUrl - The URL of the Action.\n\nblinkUrl - (optional) The Webpage or Interstitial URL that points to the Action URL\n\nwebsiteUrl - (optional) URL of the Action owner.\n\ncreatedAt - When the Action was added to the registry.\n\ntags - The tags depicting the Action's status on the registry.\n\nBrowse the Public Registry at dial.to\n\nAll blinks on the public registry are now discoverable right on https://dial.to, where blinks can be filtered by registration status.\n\nPrevious\nSecurity\nNext\nAlerts\n\nLast updated 18 days ago" }, { "url": "https://docs.dialect.to/documentation/alerts", "title": "Alerts | Actions & Alerts", "content": "Alerts\n\nDialect Alerts is a smart messaging protocol for dapp notifications and wallet-to-wallet chat. We are powering notifications and messaging for over 30 of the most-loved dapps and wallets on Solana, EVM and Aptos. \n\nAll of our tooling is open source and free to use. Our on-chain messaging protocol, v0, is live & audited on mainnet. We offer a host of off-chain tooling and services as well, including a multi-chain messaging protocol, v1, and a set of tools around powering notifications for dapps.\n\nHow to use this documentation\n\nThis documentation is meant for developers who wish to integrate Dialect into their dapps or wallets for messaging and notifications. All our tooling is available in our Github; this documentation will guide you through the relevant repos.\n\nSee the Getting started section for more information.\n\nPrevious\nThe Blinks Public Registry\nNext\nGetting started\n\nLast updated 14 days ago" }, { "url": "https://docs.dialect.to/documentation/alerts/alerts-quick-start", "title": "Alerts Quick Start | Actions & Alerts", "content": "Alerts Quick Start\n\nAn end-to-end guide on setting up notifications for your dapp.\n\nThis section provides an end-to-end quick start guide to get set up sending notifications to your users from your dapp. We get you set up for production use by walking through the following steps:\n\nCreate and configure your dapp keypair, which you use to send notifications.\n\nAdd our notifications component to your front end, for users to register and receive the notifications from you.\n\nSend dapp notifications from your backend.\n\nTry a live example of this notification bell at https://alerts-example.dialect.to.\n\nCreate Your Dapp Keypair\n\nDialect's protocol enables communication between wallets. Dapp notifications are no exception. To send notifications to user wallets, dapps should first create a keypair for messaging.\n\nCreate keypairs for your dapp and for a test user. For your test user, you may also use existing test keypairs you have, as this keypair will eventually get added to a chrome extension wallet such as Phantom for testing our front end component libraries.\n\nWe recommend using the Solana CLI to create a new keypair.\n\nCopy\n// Create a dapp keypair\n\nsolana-keygen new -o -messaging-keypair.json\n\nsolana-keygen publickey -messaging-keypair.json > dapp-pubkey.pub\n\n\n\n// [OPTIONAL] Create a test user keypair (or use one you already have in Phantom or another chrome extension wallet)\n\nsolana-keygen new -o test-user-messaging-keypair.json\n\nDO NOT share your dapp private key with anyone, not even Dialect. We never store your private key anywhere in our systems, and will never ask for it. It is for you and your use alone.\n\nYou'll need the public and private keys of this keypair in the following sections.\n\nRegister Your Keypair as a Dapp to Send Notifications\nCreate a Dialect SDK instance\n\nIn the following sections you'll execute code from Dialect's typescript SDK. First set up your preferred node and typescript environment. Then install & import Dialect SDK dependencies, and create a Dialect SDK instance.\n\nInstall React and SDK Dependencies\n\nIn this section you'll install Dialect and Solana dependencies for both the front end and backend requirements. You'll then use the backend dependencies to create a Dialect SDK instance, which you will use to register your keypair as a dapp in our system.\n\nPrerequisites\n\nThe documentation assumes that you already have @solana/web3.js installed and configured in your backend app\n\nInstall dependencies\n\nIn order to start adding messaging functionality to your web dapp, we need to install a few essential packages first\n\nnpm:\n\nCopy\nnpm install @solana/wallet-adapter-base --save\n\nnpm install @dialectlabs/sdk --save\n\nnpm install @dialectlabs/blockchain-sdk-solana --save\n\nyarn:\n\nCopy\nyarn add @solana/wallet-adapter-base\n\nyarn add @dialectlabs/sdk\n\nyarn add @dialectlabs/blockchain-sdk-solana\n\nSet DIALECT_SDK_CREDENTIALS environment variable to your dapp's Solana keypair, generated above\n\nCopy\nimport {\n\n Dialect,\n\n DialectCloudEnvironment,\n\n DialectSdk,\n\n} from '@dialectlabs/sdk';\n\n\n\nimport {\n\n Solana,\n\n SolanaSdkFactory,\n\n NodeDialectSolanaWalletAdapter\n\n} from '@dialectlabs/blockchain-sdk-solana';\n\n\n\nconst environment: DialectCloudEnvironment = 'production';\n\n\n\nconst sdk: DialectSdk = Dialect.sdk(\n\n {\n\n environment,\n\n },\n\n SolanaSdkFactory.create({\n\n // IMPORTANT: must set environment variable DIALECT_SDK_CREDENTIALS\n\n // to your dapp's Solana keypair e.g. [170,23, . . . ,300]\n\n wallet: NodeDialectSolanaWalletAdapter.create(),\n\n }),\n\n);\nRegister your dapp\n\nRegister your dapp keypair, so user keypairs can then register to and then receive notifications from you.\n\nHead to https://dashboard.dialect.to, connect your dapps’ wallet and register your Dapp name and Description to get started sending notifications.\n\nYou'll use this same SDK setup and configuration in your backend to send dapp notifications, as described below in Send notifications from your backend.\n\nBut first, let's add the notification bell to your react app, where you'll be able to subscribe for notifications and then receive them as a test user.\n\nAdd the Dialect Bell React Component to Your Front End\n\nDialect's @dialectlabs/react-ui library provides out-of-the-box react components for embedding a notification bell in your react app, from which your users can fully manage their notifications experience with you. It is a pre-built, themeable, self-sufficient and opinionated set of UI components for your users that abstracts away a large amount of notifications logic for you as a developer. Specifically, it handles:\n\nRegistration for in-app, email, and Telegram notifications, including full email and Telegram verification flows.\n\nRegistration for any number of notification types you choose to create. This could be price alerts, liquidation warnings, NFT bid events, or anything else you can dream up.\n\nIn-app feed of notifications, including a badge on the notification bell to let your users know when they have unread notifications.\n\nWe strongly recommend you use our react components to manage your client experience for your users in your dapp. These components are fully stylable to your brand, and will reduce your implementation time by 80% or more.\n\nAll you need to do as a developer is add this component to your react app, and the rest comes out of the box. Let's go through adding this component to your app.\n\nPrerequisites\n\nThe documentation assumes that you already have solana wallet adapter installed and configured in your app \n\nFollow wallet adapter guide to install it https://github.com/anza-xyz/wallet-adapter/blob/master/APP.md\n\nInstall dependencies\n\nIn order to start adding messaging functionality to your web dapp, we need to install a few essential packages first.\n\nnpm:\n\nCopy\nnpm add @dialectlabs/react-ui @dialectlabs/react-sdk-blockchain-solana\n\nyarn:\n\nCopy\nyarn add @dialectlabs/react-ui @dialectlabs/react-sdk-blockchain-solana\nAdd the Dialect Notifications Component to your app\n\nYou are now ready to add the Dialect notification bell react component to your app. To do this, let's first create a separate component in your project and call it DialectNotificationComponent that contains the code below. Specifically, this code:\n\nImport styles from the Dialect UI library\n\nConfiguresDialectSolanaSdk which integrates with the wallet adapter\n\nAdds a notifications button\n\nSet DAPP_ADDRESS variable to the public key generated in previous section\n\nTo do the above, add this file to your project:\n\nCopy\n/* DialectNotificationComponent.tsx */\n\n'use client';\n\n\n\nimport '@dialectlabs/react-ui/index.css';\n\n\n\nimport { DialectSolanaSdk } from '@dialectlabs/react-sdk-blockchain-solana';\n\nimport { NotificationsButton } from '@dialectlabs/react-ui';\n\n\n\n/* Set DAPP_ADDRESS variable to the public key generated in previous section */\n\nconst DAPP_ADDRESS = '...';\n\n\n\nexport const DialectNotificationComponent = () => {\n\n return (\n\n \n\n \n\n \n\n );\n\n};\n\nNow import this file into your main navbar component, as described in the next section.\n\nUse your new DialectNotificationComponent in your navbar \n\nOnce you've configured your project with Dialect context providers as described in the previous section, you can simply drop in the Dialect Notifications react component.\n\nCopy\n/* App.tsx */\n\n\n\nimport {\n\n ConnectionProvider,\n\n WalletProvider\n\n} from '@solana/wallet-adapter-react';\n\nimport { DialectNotificationComponent } from '';\n\n\n\nconst App = () => {\n\n return (\n\n // We're using @solana/wallet-adapter-react package for wallet api\n\n // Assuming WalletProvider and ConnectionProvider are properly configured with necessary wallets and network.\n\n \n\n \n\n {/* Your app's components go here, nested within the context providers. */}\n\n \n\n \n\n \n\n );\n\n}\n\nYou're all set! Run your app now and use the notification bell to register for notifications for whichever test user wallet you'd like.\n\nYou will begin sending notifications to that test user in the next section.\n\nCustomizing the Dialect Notification Component Themes\nAdvancing React Notifications\nStyling Notifications widget\nSee our example app in our react-ui repo:\n\nTo see a complete working example of our notifications bell check out the example nextjs app in our react component library. You can run this example like you would any nextjs application, as described from that library.\n\nSend notifications from your backend\n\nNow that you have a notification bell and modal in your react app, let's use the dapp keypair we created above to begin sending notifications to users.\n\nIf you haven't already, make sure you've registered your dapp keypair (see Register your dapp).\n\nAnd then create a Dialect SDK instance (see Create a Dialect SDK instance).\n\nStart sending messages\n\nWith your SDK instance, you can now run the following code to send a notification to all subscribed users.\n\nCopy\nconst dapp = await sdk.dapps.find();\n\nawait dapp.messages.send({\n\n title: 'Hello from Dialect',\n\n message: 'Hello from the Dialect quick start guide example.',\n\n actionsV2: {\n\n type: DappMessageActionType.LINK,\n\n links: [\n\n {\n\n label: 'Open Dialect Quick Start',\n\n url: 'https://docs.dialect.to/documentation',\n\n },\n\n ],\n\n }\n\n});\n\nIf you've registered to receive notifications from your app, this notification should now appear in your notification modal.\n\nAdvanced setup\n\nThis concludes the quick start guide. To do more advanced things like\n\nsending notifications to specific wallets, or sets of wallets,\n\nsetting up notification types, or\n\nsending notifications for specific notification types,\n\nsee the Notifications section for more info.\n\nPrevious\nGetting started\nNext\nAlerts & Monitoring\n\nLast updated 3 months ago" }, { "url": "https://docs.dialect.to/documentation/actions/blinks/add-blinks-to-your-web-app", "title": "Add blinks to your web app | Actions & Alerts", "content": "Add blinks to your web app\n\nThis section covers adding Blinks directly to your React dapp using our Blinks React SDK. The SDK is open-source and can be found in our Github.\n\nInstallation\nCopy\n# npm\n\nnpm i @dialectlabs/blinks\n\n\n\n#yarn\n\nyard add @dialectlabs/blinks\nAdding the Blink Component\n\nThe following hooks are exported from @dialectlabs/blinks/react in order to simplify the integration.\n\nuseAction - overall hook: fetches the action, sets up an adapter, inits registry and refreshes it every 10 minutes\n\nuseActionsRegistry - fetches the registry and refreshes it\n\nuseActionSolanaWalletAdapter - sets up an adapter for Action using wallet provider\n\nIf you want to build your own hooks, use Action , ActionsRegistry and ActionConfig/ActionAdapter classes and interfaces.\n\nIf you are using the useActionSolanaWalletAdapter hook, then be sure to haveand above in the component tree.\n\nBasic Usage:\nCopy\nimport '@dialectlabs/blinks/index.css';\n\nimport { useState, useEffect } from 'react';\n\nimport { Action, Blink, ActionsRegistry } from \"@dialectlabs/blinks\";\n\nimport { useAction } from '@dialectlabs/blinks/react';\n\n\n\n// needs to be wrapped with and \n\nconst App = () => {\n\n const [action, setAction] = useState(null);\n\n const actionApiUrl = '...';\n\n // useAction initiates registry, adapter and fetches the action.\n\n const { adapter } = useActionSolanaWalletAdapter('');\n\n const { action } = useAction(actionApiUrl, adapter); \n\n\n\n return action ? : null;\n\n}\nAdvanced:\nCopy\nimport '@dialectlabs/blinks/index.css';\n\nimport { useState, useEffect } from 'react';\n\nimport { Action, Blink, ActionsRegistry, type ActionAdapter } from \"@dialectlabs/blinks\";\n\nimport { useAction, useActionsRegistryInterval } from '@dialectlabs/blinks/react';\n\n\n\n// needs to be wrapped with and \n\nconst App = () => {\n\n // SHOULD be the only instance running (since it's launching an interval)\n\n const { isRegistryLoaded } = useActionsRegistryInterval();\n\n const { adapter } = useActionSolanaWalletAdapter('');\n\n \n\n return isRegistryLoaded ? : null;\n\n}\n\n\n\nconst ManyActions = ({ adapter }: { adapter: ActionAdapter }) => {\n\n const apiUrls = useMemo(() => (['...', '...', '...']), []);\n\n const [actions, setActions] = useState([]);\n\n \n\n useEffect(() => {\n\n const fetchActions = async () => {\n\n const promises = apiUrls.map(url => Action.fetch(url).catch(() => null));\n\n const actions = await Promise.all(promises);\n\n \n\n setActions(actions.filter(Boolean) as Action[]);\n\n }\n\n \n\n fetchActions();\n\n }, [apiUrls]);\n\n \n\n // we need to update the adapter every time, since it's dependent on wallet and walletModal states\n\n useEffect(() => {\n\n actions.forEach((action) => action.setAdapter(adapter));\n\n }, [actions, adapter]);\n\n \n\n return actions.map(action => (\n\n
\n\n \n\n
\n\n );\n\n}\n\nCustomize Blink Styles\n\nDialect's Blinks SDK supports customizable styles so you can render Blinks that match the style of your dApp or 3rd party site, such as Twitter.\n\nTo render a Blink with a preset pass stylePreset prop (defaults to default which is the dial.to theme) to component:\n\nCopy\nimport { Blink } from '@dialectlabs/blinks';\n\n...\n\nreturn ;\n\nStyle presets are mapped to classes the following way:\n\nx-dark -> .x-dark\n\nx-light -> .x-light\n\ndefault -> .dial-light\n\ncustom -> .custom\n\nTo override a certain preset use the following CSS Variables:\n\nCopy\n/* \n\n Use .x-dark, .x-light, .dial-light, or .custom classes \n\n .custom - does not contain any colors, radii or shadow\n\n*/\n\n.blink.x-dark {\n\n --blink-bg-primary: #202327;\n\n --blink-button: #1d9bf0;\n\n --blink-button-disabled: #2f3336;\n\n --blink-button-hover: #3087da;\n\n --blink-button-success: #00ae661a;\n\n --blink-icon-error: #ff6565;\n\n --blink-icon-error-hover: #ff7a7a;\n\n --blink-icon-primary: #6e767d;\n\n --blink-icon-primary-hover: #949ca4;\n\n --blink-icon-warning: #ffb545;\n\n --blink-icon-warning-hover: #ffc875;\n\n --blink-input-bg: #202327;\n\n --blink-input-stroke: #3d4144;\n\n --blink-input-stroke-disabled: #2f3336;\n\n --blink-input-stroke-error: #ff6565;\n\n --blink-input-stroke-hover: #6e767d;\n\n --blink-input-stroke-selected: #1d9bf0;\n\n --blink-stroke-error: #ff6565;\n\n --blink-stroke-primary: #1d9bf0;\n\n --blink-stroke-secondary: #3d4144;\n\n --blink-stroke-warning: #ffb545;\n\n --blink-text-brand: #35aeff;\n\n --blink-text-button: #ffffff;\n\n --blink-text-button-disabled: #768088;\n\n --blink-text-button-success: #12dc88;\n\n --blink-text-error: #ff6565;\n\n --blink-text-error-hover: #ff7a7a;\n\n --blink-text-input: #ffffff;\n\n --blink-text-input-disabled: #566470;\n\n --blink-text-input-placeholder: #6e767d;\n\n --blink-text-link: #6e767d;\n\n --blink-text-link-hover: #949ca4;\n\n --blink-text-primary: #ffffff;\n\n --blink-text-secondary: #949ca4;\n\n --blink-text-success: #12dc88;\n\n --blink-text-warning: #ffb545;\n\n --blink-text-warning-hover: #ffc875;\n\n --blink-transparent-error: #aa00001a;\n\n --blink-transparent-grey: #6e767d1a;\n\n --blink-transparent-warning: #a966001a;\n\n \n\n --blink-border-radius-rounded-lg: 0.25rem;\n\n --blink-border-radius-rounded-xl: 0.5rem;\n\n --blink-border-radius-rounded-2xl: 1.125rem;\n\n --blink-border-radius-rounded-button: 624.9375rem;\n\n --blink-border-radius-rounded-input: 624.9375rem;\n\n \n\n /* box-shadow */\n\n --blink-shadow-container: 0px 2px 8px 0px rgba(59, 176, 255, 0.22), 0px 1px 48px 0px rgba(29, 155, 240, 0.24);\n\n}\n\nBe sure to override with CSS Specificity in mind or by import order\n\nUsing these CSS classes, you can customize the styles to fit the UI of your application.\n\nPrevious\nBlinks\nNext\nAdd blinks to your mobile app\n\nLast updated 7 days ago", "code_snippets": ["import '@dialectlabs/blinks/index.css';import { useState, useEffect } from 'react';import { Action, Blink, ActionsRegistry } from @dialectlabs/blinks;import { useAction } from '@dialectlabs/blinks/react';const App = () => {const [action, setAction] = useState(null);const actionApiUrl = '...';const { adapter } = useActionSolanaWalletAdapter('');const { action } = useAction(actionApiUrl, adapter);return action ? : null;}", "import '@dialectlabs/blinks/index.css';import { useState, useEffect } from 'react';import { Action, Blink, ActionsRegistry, type ActionAdapter } from @dialectlabs/blinks;import { useAction, useActionsRegistryInterval } from '@dialectlabs/blinks/react';const App = () => {const { isRegistryLoaded } = useActionsRegistryInterval();const { adapter } = useActionSolanaWalletAdapter('');return isRegistryLoaded ? : null;}const ManyActions = ({ adapter }: { adapter: ActionAdapter }) => {const apiUrls = useMemo(() => (['...', '...', '...']), []);const [actions, setActions] = useState([]);useEffect(() => {const fetchActions = async () => {const promises = apiUrls.map(url => Action.fetch(url).catch(() => null));const actions = await Promise.all(promises);setActions(actions.filter(Boolean) as Action[]);}fetchActions();}, [apiUrls]);useEffect(() => {actions.forEach((action) => action.setAdapter(adapter));}, [actions, adapter]);return actions.map(action => (
);}"] }, { "url": "https://docs.dialect.to/documentation/alerts/getting-started", "title": "Getting started | Actions & Alerts", "content": "Getting started\n\nTo learn how to setup notifications, see the Notifications Quick Start Guide.\n\nFor a more in-depth guide to notifications for your dapp see the Notifications section. Or for a run through on how to send and receive messages with Dialect, which powers notifications under the hood, see the Messaging section.\n\nPrevious\nAlerts\nNext\nAlerts Quick Start\n\nLast updated 4 months ago" }, { "url": "https://docs.dialect.to/documentation/alerts/alerts-and-monitoring", "title": "Alerts & Monitoring | Actions & Alerts", "content": "Alerts & Monitoring\n\nThis section describes how to set up notifications for your dapp. The end-user experience is the ability for your user's to subscribe to receive timely notifications from your dapp over the channels they care about — SMS, telegram, email, and Dialect inboxes. Flexible tooling allows dapp developers to configure which channels are available, as well as which notification types users can subscribe to — be it NFT buyout requests, liquidation warnings, filled orders, DAO proposal updates, new raffle listings, social posts, etc.\n\nDialect uses its messaging primitives under the hood to power notifications. In the same way that a business manages an email address to send notifications and other messages to its customers, a dapp manages a wallet keypair for performing messaging with the Dialect protocol (if you're curious how messaging works with Dialect, see the Messaging section).\n\nThe rest of this section will abstract away messaging, and focus on the tools used for configuring notifications — from registering a dapp, deciding how to monitor for on- or off-chain events, configuring both the Dialect protocol and traditional web2 channels for sending notifications, to dropping in React components that let your users manage their notifications from your dapp.\n\nPrevious\nAlerts Quick Start\nNext\nRegistering Your Dapp\n\nLast updated 3 months ago" }, { "url": "https://docs.dialect.to/documentation/alerts/alerts-and-monitoring/decide-how-to-monitor-events", "title": "Decide How to Monitor Events | Actions & Alerts", "content": "Decide How to Monitor Events\n\nNotifications can be triggered from a wide range of user behaviors and/or programmatic events. For example: NFT buyout requests, liquidation warnings, filled orders, new DAO proposals, new raffle listings, new social posts, etc.\n\nOption 1: Use Dialect's Open Source Monitoring Tooling\n\nDialect provides open-source, customizable monitor tooling and service infrastructure to help detect on-chain and/or off-chain events that you would like to notify subscribers about. \n\nOption 2: Use Dialect's Open Source SDK to send Notifications From Your Existing Services\n\nIf you already have existing event detection in your own backend service, just jump straight to this section to learn how to send notifications from within your existing service:\n\nUsing Your Existing Event Detection\n\nOtherwise, continue forward to learn how to use the Dialect Monitor tooling to detect events and programmatically fire notifications.\n\nPrevious\nRegistering Your Dapp\nNext\nUsing Dialect Monitor to Detect Events\n\nLast updated 3 months ago" }, { "url": "https://docs.dialect.to/documentation/alerts/alerts-and-monitoring/registering-your-dapp", "title": "Registering Your Dapp | Actions & Alerts", "content": "Registering Your Dapp\n\nTo get started, you must first register your dapp within the Dialect Cloud. Analogous to how businesses/users may register for web2 services via an email address, Dialect Cloud uses wallet authentication to register and manage dapps that use Dialect services.\n\nCreate a keypair for your dapp\n\nCreating a keypair is analagous to creating a username & password. It is important to first do your own research on how to securely create and manage a keypair, as it will be used to access/administrate your Dialect Cloud account.\n\nFirst, you must create a keypair and register the corresponding publickey with the Dialect Cloud. We recommend using the Solana CLI to create a new keypair.\n\nCopy\nsolana-keygen new -o -messaging-keypair-devnet.json\n\nsolana-keygen publickey -messaging-keypair-devnet.json > dapp-pubkey.pub\n\nThis corresponding publickey is analagous to your dapp's \"account\" identity, and the keypair can be used to sign transactions to authenticate permissioned actions within Dialect Cloud.\n\nRegister your dapp in Dialect Cloud\n\nCreate an sdk instance following these instructions from . Then register a new dapp messaging keypair for this keypair using the Dialect SDK snippet below.\n\nDialect's database never stores your dapp's private keys, only the public key.\n\nCopy\n// N.b. this created dapp is associated with the wallet public key connected\n\n// to the sdk instance.\n\nconst dapp = await sdk.dapps.create({\n\n name: 'My test dapp',\n\n description: `My test dapp's description.`,\n\n blockchainType: BlockchainType.SOLANA\n\n});\nPrevious\nAlerts & Monitoring\nNext\nDecide How to Monitor Events\n\nLast updated 3 months ago", "code_snippets": ["const dapp = await sdk.dapps.create({name: 'My test dapp',description: `My test dapp's description.`,blockchainType: BlockchainType.SOLANA});"] }, { "url": "https://docs.dialect.to/documentation/alerts/alerts-and-monitoring/decide-how-to-monitor-events/using-dialect-monitor-to-detect-events", "title": "Using Dialect Monitor to Detect Events | Actions & Alerts", "content": "Using Dialect Monitor to Detect Events\nOption 1: Use Dialect's Open Source Monitoring Tooling\n\nDialect has sophisticated, open-source tools for detecting events about changes to data (on- or off-chain) and turning those events into notification messages.\n\nThe first piece of this tooling is the Monitor library, an open-source Typescript package that makes it easy to extract and transform data streams into targeted, timely smart messages. \n\nThe monitor library provides a rich, high-level API for unbounded data-stream processing to analyze extracted on-chain data or data from other off-chain services. \n\nData-stream processing features include:\n\nWindowing: fixed size, fixed time, fixed size sliding\n\nAggregation: average, min, max\n\nThresholding: rising edge, falling edge\n\nRate limiting\n\nThe Monitor library is best learned by examples. This section describes how to use Dialect monitor to build monitoring apps by showing you various example apps in the examples/ folder of the repository. Follow along in this section, and refer to the code in those examples.\n\nDapp developer's integrating Dialect notifications should first familiarize themselves with the Monitor library, and then decide which strategies can be used for your use-cases. Alternatively, it may also be helpful to dive straight into an existing open-source implementation detailed in this section, especially if a use-case similar to yours has already been demonstrated.\n\nOnce you have completed these sections and implemented the Monitor for your use-case, don't forget to visit this section to view Dialect's Monitor Service hosting recommendations.\n\nWe hope you find these sections useful, and would love your contributions to the Monitor library as you may choose to add custom features for your specific use-cases.\n\nPrevious\nDecide How to Monitor Events\nNext\nLearning to Use Monitor Builder: Example 1\n\nLast updated 3 months ago" }, { "url": "https://docs.dialect.to/documentation/alerts/alerts-and-monitoring/decide-how-to-monitor-events/using-dialect-monitor-to-detect-events/learning-to-use-monitor-builder-supplying-data", "title": "Learning to Use Monitor Builder: Supplying Data | Actions & Alerts", "content": "Learning to Use Monitor Builder: Supplying Data\n\nA poll type data source is shown below. Within this poll you would likely perform some custom on- or off-chain data collection. Poll duration is also configured.\n\nCopy\n .poll((subscribers: ResourceId[]) => {\n\n const sourceData: SourceData[] = subscribers.map(\n\n (resourceId) => ({\n\n data: {\n\n cratio: Math.random(),\n\n healthRatio: Math.random(),\n\n resourceId,\n\n },\n\n groupingKey: resourceId.toString(),\n\n }),\n\n );\n\n return Promise.resolve(sourceData);\n\n }, Duration.fromObject({ seconds: 3 }))\n\nA push type data source is describer in this example. \n\nPrevious\nLearning to Use Monitor Builder: Builder and Data Type\nNext\nLearning to Use Monitor Builder: Data Transformation\n\nLast updated 1 year ago", "code_snippets": [" .poll((subscribers: ResourceId[]) => {const sourceData: SourceData[] = subscribers.map((resourceId) => ({data: {cratio: Math.random(),healthRatio: Math.random(),resourceId,},groupingKey: resourceId.toString(),}),);return Promise.resolve(sourceData);}, Duration.fromObject({ seconds: 3 }))"] }, { "url": "https://docs.dialect.to/documentation/alerts/alerts-and-monitoring/decide-how-to-monitor-events/using-dialect-monitor-to-detect-events/learning-to-use-monitor-builder-builder-and-data-type", "title": "Learning to Use Monitor Builder: Builder and Data Type | Actions & Alerts", "content": "Learning to Use Monitor Builder: Builder and Data Type\n\nMonitor.builder (source\n\nCopy\n// Dialect SDK is configured and must be supplied\n\n// below in builder props\n\nconst environment: DialectCloudEnvironment = 'development';\n\nconst dialectSolanaSdk: DialectSdk = Dialect.sdk(\n\n {\n\n environment,\n\n },\n\n SolanaSdkFactory.create({\n\n // IMPORTANT: must set environment variable DIALECT_SDK_CREDENTIALS\n\n // to your dapp's Solana messaging wallet keypair e.g. [170,23, . . . ,300]\n\n wallet: NodeDialectSolanaWalletAdapter.create(),\n\n }),\n\n);\n\n\n\n// Define a data type to monitor\n\ntype YourDataType = {\n\n cratio: number;\n\n healthRatio: number;\n\n resourceId: ResourceId;\n\n};\n\n\n\n// Build a Monitor to detect and deliver notifications\n\nconst monitor: Monitor = Monitors.builder({\n\n sdk: dialectSolanaSdk,\n\n subscribersCacheTTL: Duration.fromObject({ seconds: 5 }),\n\n})\n\n // Configure data source type\n\n .defineDataSource()\n\nPrevious\nLearning to Use Monitor Builder: Example 1\nNext\nLearning to Use Monitor Builder: Supplying Data\n\nLast updated 1 year ago", "code_snippets": ["const environment: DialectCloudEnvironment = 'development';const dialectSolanaSdk: DialectSdk = Dialect.sdk({environment,},SolanaSdkFactory.create({wallet: NodeDialectSolanaWalletAdapter.create(),}),);type YourDataType = {cratio: number;healthRatio: number;resourceId: ResourceId;};const monitor: Monitor = Monitors.builder({sdk: dialectSolanaSdk,subscribersCacheTTL: Duration.fromObject({ seconds: 5 }),}).defineDataSource()"] }, { "url": "https://docs.dialect.to/documentation/alerts/alerts-and-monitoring/decide-how-to-monitor-events/using-dialect-monitor-to-detect-events/learning-to-use-monitor-builder-data-transformation", "title": "Learning to Use Monitor Builder: Data Transformation | Actions & Alerts", "content": "Learning to Use Monitor Builder: Data Transformation\n\nDuring the transform step, streaming data from the previous step (eg poll, push) is operated on in succession to identify some event and trigger actions. In this snippet, a falling-edge of 0.5 on a number data type.\n\nCopy\n .transform({\n\n keys: ['cratio'],\n\n pipelines: [\n\n Pipelines.threshold({\n\n type: 'falling-edge',\n\n threshold: 0.5,\n\n }),\n\n ],\n\n })\n\nMany other data-stream processing features exist, including:\n\nWindowing: fixed size, fixed time, fixed size sliding\n\nAggregation: average, min, max\n\nThresholding: rising edge, falling edge\n\nMore Examples:\n\nmonitor/005-custom-pipelines-using-operators.ts at main · dialectlabs/monitor\nGitHub\nCustom Pipeline Operators Examples\nmonitor/008-diff-pipeline.ts at main · dialectlabs/monitor\nGitHub\nArray Diff\n\nAn array diff pipeline can be used to track when items are added or removed from an array.\n\nPrevious\nLearning to Use Monitor Builder: Supplying Data\nNext\nLearning to Use Monitor Builder: Notify Step\n\nLast updated 1 year ago" }, { "url": "https://docs.dialect.to/documentation/alerts/alerts-and-monitoring/decide-how-to-monitor-events/using-dialect-monitor-to-detect-events/learning-to-use-monitor-builder-example-1", "title": "Learning to Use Monitor Builder: Example 1 | Actions & Alerts", "content": "Learning to Use Monitor Builder: Example 1\n\nThis example emulates e2e scenario for monitoring some on- or off-chain resources for a set of subscribers and has 2 parts:\n\nClient that emulates several users subscribing for dialect notifications from a monitoring service\n\nServer that monitors some data for a set of monitoring service subscribers\n\nThis example follows the code at examples/000.1-solana-monitoring-service.ts\n\nServer example:\n\nCopy\nimport { Monitor, Monitors, Pipelines, ResourceId, SourceData } from '../src';\n\nimport { Duration } from 'luxon';\n\n\n\n// 1. Common Dialect SDK imports\n\nimport {\n\n Dialect,\n\n DialectCloudEnvironment,\n\n DialectSdk,\n\n} from '@dialectlabs/sdk';\n\n\n\n// 2. Solana-specific imports\n\nimport {\n\n Solana,\n\n SolanaSdkFactory,\n\n NodeDialectSolanaWalletAdapter\n\n} from '@dialectlabs/blockchain-sdk-solana';\n\n\n\n// 3. Create Dialect Solana SDK\n\nconst environment: DialectCloudEnvironment = 'development';\n\nconst dialectSolanaSdk: DialectSdk = Dialect.sdk(\n\n {\n\n environment,\n\n },\n\n SolanaSdkFactory.create({\n\n // IMPORTANT: must set environment variable DIALECT_SDK_CREDENTIALS\n\n // to your dapp's Solana messaging wallet keypair e.g. [170,23, . . . ,300]\n\n wallet: NodeDialectSolanaWalletAdapter.create(),\n\n }),\n\n);\n\n\n\n// 4. Define a data type to monitor\n\ntype YourDataType = {\n\n cratio: number;\n\n healthRatio: number;\n\n resourceId: ResourceId;\n\n};\n\n\n\n// 5. Build a Monitor to detect and deliver notifications\n\nconst dataSourceMonitor: Monitor = Monitors.builder({\n\n sdk: dialectSolanaSdk,\n\n subscribersCacheTTL: Duration.fromObject({ seconds: 5 }),\n\n})\n\n // (5a) Define data source type\n\n .defineDataSource()\n\n // (5b) Supply data to monitor, in this case by polling\n\n // Push type available, see example 007\n\n .poll((subscribers: ResourceId[]) => {\n\n const sourceData: SourceData[] = subscribers.map(\n\n (resourceId) => ({\n\n data: {\n\n cratio: Math.random(),\n\n healthRatio: Math.random(),\n\n resourceId,\n\n },\n\n groupingKey: resourceId.toString(),\n\n }),\n\n );\n\n return Promise.resolve(sourceData);\n\n }, Duration.fromObject({ seconds: 3 }))\n\n // (5c) Transform data source to detect events\n\n .transform({\n\n keys: ['cratio'],\n\n pipelines: [\n\n Pipelines.threshold({\n\n type: 'falling-edge',\n\n threshold: 0.5,\n\n }),\n\n ],\n\n })\n\n // (5d) Add notification sinks for message delivery strategy\n\n // Monitor has several sink types available out-of-the-box.\n\n // You can also define your own sinks to deliver over custom channels\n\n // (see examples/004-custom-notification-sink)\n\n // Below, the dialectSdk sync is used, which handles logic to send\n\n // notifications to all all (and only) the channels which has subscribers have enabled\n\n .notify()\n\n .dialectSdk(\n\n ({ value }) => {\n\n return {\n\n title: 'dApp cratio warning',\n\n message: `Your cratio = ${value} below warning threshold`,\n\n };\n\n },\n\n {\n\n dispatch: 'unicast',\n\n to: ({ origin: { resourceId } }) => resourceId,\n\n },\n\n )\n\n .also()\n\n .transform({\n\n keys: ['cratio'],\n\n pipelines: [\n\n Pipelines.threshold({\n\n type: 'rising-edge',\n\n threshold: 0.5,\n\n }),\n\n ],\n\n })\n\n .notify()\n\n .dialectSdk(\n\n ({ value }) => {\n\n return {\n\n title: 'dApp cratio warning',\n\n message: `Your cratio = ${value} above warning threshold`,\n\n };\n\n },\n\n {\n\n dispatch: 'unicast',\n\n to: ({ origin: { resourceId } }) => resourceId,\n\n },\n\n )\n\n // (5e) Build the Monitor\n\n .and()\n\n .build();\n\n\n\n// 6. Start the monitor\n\ndataSourceMonitor.start();\n\n\nPlease follow the instructions below to run the example\n\nStep 1. Generate a new test keypair representing your dapp's monitoring service\n\nCopy\nexport your_path=~/projects/dialect/keypairs/\n\nsolana-keygen new --outfile ${your_path}/monitor-localnet-keypair.private\n\nsolana-keygen pubkey ${your_path}/monitor-localnet-keypair.private > ${your_path}/monitor-localnet-keypair.public\n\nStep 2. Start server with keypair assigned to env DIALECT_SDK_CREDENTIALS\n\nCopy\ncd examples\n\nexport your_path=~/projects/dialect/keypairs\n\nDIALECT_SDK_CREDENTIALS=$(cat ${your_path}/monitor-localnet-keypair.private) ts-node ./000.1-solana-monitoring-service-server.ts\n\nStep 3. Start client\n\nCopy\ncd examples\n\nexport your_path=~/projects/dialect/keypairs\n\nDAPP_PUBLIC_KEY=$(cat ${your_path}/monitor-localnet-keypair.public) \\\n\nts-node ./000.1-solana-monitoring-service-client.ts\n\nStep 4. Look at client logs for notifications\n\nWhen both client and server are started, server will start polling data and notifying subscribers\n\nPrevious\nUsing Dialect Monitor to Detect Events\nNext\nLearning to Use Monitor Builder: Builder and Data Type\n\nLast updated 1 year ago", "code_snippets": ["import { Monitor, Monitors, Pipelines, ResourceId, SourceData } from '../src';import { Duration } from 'luxon';import {Dialect,DialectCloudEnvironment,DialectSdk,} from '@dialectlabs/sdk';import {Solana,SolanaSdkFactory,NodeDialectSolanaWalletAdapter} from '@dialectlabs/blockchain-sdk-solana';const environment: DialectCloudEnvironment = 'development';const dialectSolanaSdk: DialectSdk = Dialect.sdk({environment,},SolanaSdkFactory.create({wallet: NodeDialectSolanaWalletAdapter.create(),}),);type YourDataType = {cratio: number;healthRatio: number;resourceId: ResourceId;};const dataSourceMonitor: Monitor = Monitors.builder({sdk: dialectSolanaSdk,subscribersCacheTTL: Duration.fromObject({ seconds: 5 }),}).defineDataSource().poll((subscribers: ResourceId[]) => {const sourceData: SourceData[] = subscribers.map((resourceId) => ({data: {cratio: Math.random(),healthRatio: Math.random(),resourceId,},groupingKey: resourceId.toString(),}),);return Promise.resolve(sourceData);}, Duration.fromObject({ seconds: 3 })).transform({keys: ['cratio'],pipelines: [Pipelines.threshold({type: 'falling-edge',threshold: 0.5,}),],}).notify().dialectSdk(({ value }) => {return {title: 'dApp cratio warning',message: `Your cratio = ${value} below warning threshold`,};},{dispatch: 'unicast',to: ({ origin: { resourceId } }) => resourceId,},).also().transform({keys: ['cratio'],pipelines: [Pipelines.threshold({type: 'rising-edge',threshold: 0.5,}),],}).notify().dialectSdk(({ value }) => {return {title: 'dApp cratio warning',message: `Your cratio = ${value} above warning threshold`,};},{dispatch: 'unicast',to: ({ origin: { resourceId } }) => resourceId,},).and().build();dataSourceMonitor.start();", "export your_path=~/projects/dialect/keypairs/solana-keygen new --outfile ${your_path}/monitor-localnet-keypair.privatesolana-keygen pubkey ${your_path}/monitor-localnet-keypair.private > ${your_path}/monitor-localnet-keypair.public", "cd examplesexport your_path=~/projects/dialect/keypairsDIALECT_SDK_CREDENTIALS=$(cat ${your_path}/monitor-localnet-keypair.private) ts-node ./000.1-solana-monitoring-service-server.ts", "cd examplesexport your_path=~/projects/dialect/keypairsDAPP_PUBLIC_KEY=$(cat ${your_path}/monitor-localnet-keypair.public) \ts-node ./000.1-solana-monitoring-service-client.ts"] }, { "url": "https://docs.dialect.to/documentation/alerts/alerts-and-monitoring/decide-how-to-monitor-events/using-dialect-monitor-to-detect-events/learning-to-use-monitor-builder-notify-step", "title": "Learning to Use Monitor Builder: Notify Step | Actions & Alerts", "content": "Learning to Use Monitor Builder: Notify Step\n\nThe dialectSdk notification sink is the standard notification sink. This data sink allows to unicast, multicast, or broadcast a message. Under the hood the SDK handles delivering the notification to any-and-all notification channels that the subscriber(s) has enabled.\n\nCopy\n .notify()\n\n .dialectSdk(\n\n ({ value }) => {\n\n return {\n\n title: 'dApp cratio warning',\n\n message: `Your cratio = ${value} below warning threshold`,\n\n };\n\n },\n\n {\n\n dispatch: 'unicast',\n\n to: ({ origin: { resourceId } }) => resourceId,\n\n },\n\n )\n\nCustom sinks can be added as show in this example.\n\nPrevious\nLearning to Use Monitor Builder: Data Transformation\nNext\nMonitor Hosting Options\n\nLast updated 1 year ago", "code_snippets": [" .notify().dialectSdk(({ value }) => {return {title: 'dApp cratio warning',message: `Your cratio = ${value} below warning threshold`,};},{dispatch: 'unicast',to: ({ origin: { resourceId } }) => resourceId,},)"] }, { "url": "https://docs.dialect.to/documentation/alerts/alerts-and-monitoring/decide-how-to-monitor-events/using-dialect-monitor-to-detect-events/monitor-hosting-options", "title": "Monitor Hosting Options | Actions & Alerts", "content": "Monitor Hosting Options\n\nNow that you have learned to implement a Dialect Monitor to detect and programmatically send notifications to your subscribers, you will need to host that monitor within a service.\n\nIf you already have a preferred infrastructure/framework for hosting services, you can simply choose to host and manage your Monitor that way, and you can skip directly to this section to setup your UI/UX experience for users:\n\nAdvancing React Notifications\n\nOtherwise, Dialect offers an opinionated/standardized way of hosting a Monitor within a Dialect Monitoring Service (Nest.js server implementation).\n\nIf you would like to use this opinionated hosting option, continue forward.\n\nPrevious\nLearning to Use Monitor Builder: Notify Step\nNext\nUsing Dialect Monitoring Service\n\nLast updated 1 year ago" }, { "url": "https://docs.dialect.to/documentation/alerts/alerts-and-monitoring/decide-how-to-monitor-events/using-your-existing-event-detection", "title": "Using Your Existing Event Detection | Actions & Alerts", "content": "Using Your Existing Event Detection\nOption 2: Use Dialect's Open Source SDK to send Notifications From Your Existing Services\n\nIf you already have off-chain services that are detecting the events you care about, you can easily import the Dialect SDK into those services to send notifications to subscribers right as those events are detected. \n\nThe following sections will walk through importing the SDK into your application and sending notifications.\n\nPrevious\nUsing Dialect Monitoring Service\nNext\nUse Dialect SDK to Send Notifications\n\nLast updated 3 months ago" }, { "url": "https://docs.dialect.to/documentation/alerts/alerts-and-monitoring/decide-how-to-monitor-events/using-dialect-monitor-to-detect-events/using-dialect-monitoring-service", "title": "Using Dialect Monitoring Service | Actions & Alerts", "content": "Using Dialect Monitoring Service\nDialect Reference Implementation\n\nTo wrap your Monitor within a monitoring service, see Dialect's default reference implementation at:\n\nhttps://github.com/dialectlabs/monitoring-service-template\ngithub.com\nMonitoring Service Template Repository\nOpen Source Implementations of the Monitoring Service\n\nIt could also be useful to explore some real, open-source partner implementations. See if any of these repositories have use-cases similar to yours. \n\nNot all of these implementations are using the latest version of Dialect packages. It is highly recommended that you use these to examples to learn from, but implement yours with all latest Dialect package dependencies to take advantage of new features and bug fixes.\n\nGovernance / DAO\nDeFi\nNext Steps\n\nNow that you have built and are hosting a monitoring service, you can jump straight to setting up your Notifications UI/UX:\n\nAdvancing React Notifications\nPrevious\nMonitor Hosting Options\nNext\nUsing Your Existing Event Detection\n\nLast updated 1 year ago" }, { "url": "https://docs.dialect.to/documentation/alerts/alerts-and-monitoring/decide-how-to-monitor-events/using-your-existing-event-detection/use-dialect-sdk-to-send-notifications", "title": "Use Dialect SDK to Send Notifications | Actions & Alerts", "content": "Use Dialect SDK to Send Notifications\n\nUsing the Dialect SDK to send notifications from within your backend services is essentially a two-step process:\n\nLoad your dapp from a Dialect SDK instance using your dapp's DIALECT_SDK_CREDENTIALS and configuration parameters.\n\nSend dialect notifications at the place of event in your application.\n\nIt is up to you how to optimize your backend and integrate these two steps to send timely notifications to your users. Of course, if you end up finding that your existing service are not well suited for event monitoring and notification delivery, you can explore using the Dialect Monitor to build a custom on- or off-chain monitoring service.\n\nThese sections in the SDK portion of documentation detail this easy two-step process:\n\nLoad your dapp\nSending Dapp-to-User Messages\n\nHere is an example of a live integration of the Dialect SDK into the governance-api backend. This integration is used power notifications for post/comment upvotes & replies on the Realms Discover dapp. The Dialect SDK is setup here (in this case, wrapped within NestJs to match their architecture), and an example of firing a notification from within their existing services occurs here.\n\nNow that you have setup notifications in your backend, you are ready to set up your Notifications UI/UX.\n\nPrevious\nUsing Your Existing Event Detection\nNext\nAdvancing React Notifications\n\nLast updated 3 months ago" }, { "url": "https://docs.dialect.to/documentation/alerts/alerts-and-monitoring/advancing-react-notifications", "title": "Advancing React Notifications | Actions & Alerts", "content": "Advancing React Notifications\n\nTry a live example of the Dialect notification bell at https://alerts-example.dialect.to.\n\nPrevious\nUse Dialect SDK to Send Notifications\nNext\nUsing development environment\n\nLast updated 3 months ago" }, { "url": "https://docs.dialect.to/documentation/alerts/alerts-and-monitoring/advancing-react-notifications/using-development-environment", "title": "Using development environment | Actions & Alerts", "content": "Using development environment\n\nWe provide a free to use development environment to test your notifications. Here's example how to configure development environment:\n\nCopy\n'use client';\n\n\n\nimport '@dialectlabs/react-ui/index.css';\n\n\n\nimport { DialectSolanaSdk } from '@dialectlabs/react-sdk-blockchain-solana';\n\nimport {\n\n Icons,\n\n NotificationTypeStyles,\n\n NotificationsButton,\n\n} from '@dialectlabs/react-ui';\n\n\n\nconst DAPP_ADDRESS = '...';\n\n\n\nexport const DialectSolanaNotificationsButton = () => {\n\n return (\n\n \n\n \n\n \n\n );\n\n};\n\nPrevious\nAdvancing React Notifications\nNext\nStyling Notifications widget\n\nLast updated 3 months ago", "code_snippets": ["'use client';import '@dialectlabs/react-ui/index.css';import { DialectSolanaSdk } from '@dialectlabs/react-sdk-blockchain-solana';import {Icons,NotificationTypeStyles,NotificationsButton,} from '@dialectlabs/react-ui';const DAPP_ADDRESS = '...';export const DialectSolanaNotificationsButton = () => {return ();};"] }, { "url": "https://docs.dialect.to/documentation/alerts/alerts-and-monitoring/advancing-react-notifications/overriding-icons", "title": "Overriding icons | Actions & Alerts", "content": "Overriding icons\n\nYou can override icons according to your icons set in the app. Here's an example how to render a custom react component instead of built in icons:\n\nCopy\n// DialectNotificationComponent.tsx\n\n'use client';\n\n\n\nimport '@dialectlabs/react-ui/index.css';\n\n\n\nimport { SVGProps } from 'react';\n\nimport { DialectSolanaSdk } from '@dialectlabs/react-sdk-blockchain-solana';\n\nimport {\n\n Icons,\n\n NotificationTypeStyles,\n\n NotificationsButton,\n\n} from '@dialectlabs/react-ui';\n\n\n\nconst DAPP_ADDRESS = '...';\n\n\n\n// Override a set of icons in the Icons variable before using dialect component\n\nIcons.Close = (props: SVGProps) => {\n\n // render your close icon instead of the default one\n\n return null;\n\n}\n\n\n\nexport const DialectSolanaNotificationsButton = () => {\n\n return (\n\n \n\n \n\n \n\n );\n\n};\n\nHere's the full list of built in icons:\n\nCopy\nexport const Icons = {\n\n Loader: SpinnerDots,\n\n Settings: SettingsIcon,\n\n ArrowLeft: ArrowLeftIcon,\n\n ArrowRight: ArrowRightIcon,\n\n Close: CloseIcon,\n\n Bell: BellIcon,\n\n BellButton: BellButtonIcon,\n\n BellButtonOutline: BellButtonIconOutline,\n\n Trash: TrashIcon,\n\n Xmark: XmarkIcon,\n\n Resend: ResendIcon,\n\n Wallet: WalletIcon,\n\n};\nPrevious\nStyling Notifications widget\nNext\nStyling different notification types\n\nLast updated 3 months ago", "code_snippets": ["'use client';import '@dialectlabs/react-ui/index.css';import { SVGProps } from 'react';import { DialectSolanaSdk } from '@dialectlabs/react-sdk-blockchain-solana';import {Icons,NotificationTypeStyles,NotificationsButton,} from '@dialectlabs/react-ui';const DAPP_ADDRESS = '...';Icons.Close = (props: SVGProps) => {return null;}export const DialectSolanaNotificationsButton = () => {return ();};"] }, { "url": "https://docs.dialect.to/documentation/alerts/alerts-and-monitoring/advancing-react-notifications/customizing-notifications-channels", "title": "Customizing notifications channels | Actions & Alerts", "content": "Customizing notifications channels\n\nCurrently we support the following notifications channels:\n\nwallet\n\ntelegram\n\nemail\n\nBy default all channels are enabled, but you can pass a set of different channels:\n\nCopy\n'use client';\n\n\n\nimport '@dialectlabs/react-ui/index.css';\n\n\n\nimport { DialectSolanaSdk } from '@dialectlabs/react-sdk-blockchain-solana';\n\nimport {\n\n Icons,\n\n NotificationTypeStyles,\n\n NotificationsButton,\n\n} from '@dialectlabs/react-ui';\n\n\n\nconst DAPP_ADDRESS = '...';\n\n\n\nexport const DialectSolanaNotificationsButton = () => {\n\n return (\n\n \n\n /* enables wallet channel only */\n\n \n\n \n\n );\n\n};\nPrevious\nStyling different notification types\nNext\nCustomizing notifications button\n\nLast updated 3 months ago", "code_snippets": ["'use client';import '@dialectlabs/react-ui/index.css';import { DialectSolanaSdk } from '@dialectlabs/react-sdk-blockchain-solana';import {Icons,NotificationTypeStyles,NotificationsButton,} from '@dialectlabs/react-ui';const DAPP_ADDRESS = '...';export const DialectSolanaNotificationsButton = () => {return ();};"] }, { "url": "https://docs.dialect.to/documentation/alerts/alerts-and-monitoring/advancing-react-notifications/styling-different-notification-types", "title": "Styling different notification types | Actions & Alerts", "content": "Styling different notification types\n\nYou'll probably have a multiple notification types for your app. By default all notifications are rendered with the same bell icon.\n\nDefault notification rendering\n\nYou can customize icon depending on notification types. For example you might want to have a green checkmark if notification is 'positive' for user, or add a red cross if notification is 'negative' for user.\n\ncustomizing a notification icon\n\nSee how to manage your notification types:\n\nManaging notification types\n\nHere's an example how to achieve it:\n\nCopy\n'use client';\n\n\n\nimport '@dialectlabs/react-ui/index.css';\n\n\n\nimport { DialectSolanaSdk } from '@dialectlabs/react-sdk-blockchain-solana';\n\nimport {\n\n Icons,\n\n NotificationTypeStyles,\n\n NotificationsButton,\n\n} from '@dialectlabs/react-ui';\n\n\n\nconst DAPP_ADDRESS = '...';\n\n\n\n// assume that you created notification type with human readable id 'fav_nft_listed'\n\n// You can add as many entries to NotificationTypeStyles\n\nNotificationTypeStyles.fav_nft_listed = {\n\n Icon: , // custom react component to render icon\n\n iconColor: '#FFFFFF',\n\n iconBackgroundColor: '#FF0000',\n\n iconBackgroundBackdropColor: '#FF00001A',\n\n linkColor: '#FF0000', // notifications might contain CTA link, you can customize color\n\n};\n\n\n\nexport const DialectSolanaNotificationsButton = () => {\n\n return (\n\n \n\n \n\n \n\n );\n\n};\n\nPrevious\nOverriding icons\nNext\nCustomizing notifications channels\n\nLast updated 3 months ago" }, { "url": "https://docs.dialect.to/documentation/alerts/alerts-and-monitoring/advancing-react-notifications/customizing-notifications-button", "title": "Customizing notifications button | Actions & Alerts", "content": "Customizing notifications button\n\nIn some cases you might want to use your custom button component. \n\nNotificationButton component can accept a function as a children with the following properties:\n\nopen - boolean value indicating if dialect modal is open\n\nsetOpen - react callback to control dialect modal open state\n\nunreadCount - number of unread notifications in case if you want to render unread notifications badge\n\nref - react ref callback to your component under the hood. You must pass ref to your button.\n\nHere's example of passing a custom component instead of built-in button:\n\nCopy\n'use client';\n\n\n\nimport '@dialectlabs/react-ui/index.css';\n\n\n\nimport { DialectSolanaSdk } from '@dialectlabs/react-sdk-blockchain-solana';\n\nimport {\n\n Icons,\n\n NotificationTypeStyles,\n\n NotificationsButton,\n\n} from '@dialectlabs/react-ui';\n\n\n\nconst DAPP_ADDRESS = '...';\n\n\n\nexport const DialectSolanaNotificationsButton = () => {\n\n return (\n\n \n\n \n\n {({ open, setOpen, unreadCount, ref }) => {\n\n return (\n\n \n\n );\n\n }}\n\n \n\n \n\n );\n\n};\nPrevious\nCustomizing notifications channels\nNext\nUsing your own modal component\n\nLast updated 3 months ago" }, { "url": "https://docs.dialect.to/documentation/alerts/alerts-and-monitoring/advancing-react-notifications/using-your-own-modal-component", "title": "Using your own modal component | Actions & Alerts", "content": "Using your own modal component\n\nIn some rare cases you might want to highly customize modal window. The easiest way is to use your own component. \n\nNotificationButton component can accept a react component reference renderModalComponent with the following arguments:\n\nopen - boolean value indicating if dialect modal is open\n\nsetOpen - react callback to control dialect modal open state\n\nchildren - children components that your modal component should render. You must render children.\n\nref - react ref callback to your component under the hood. You must pass reference.\n\nCopy\n'use client';\n\n\n\nimport '@dialectlabs/react-ui/index.css';\n\n\n\nimport { DialectSolanaSdk } from '@dialectlabs/react-sdk-blockchain-solana';\n\nimport {\n\n Icons,\n\n NotificationTypeStyles,\n\n NotificationsButton,\n\n} from '@dialectlabs/react-ui';\n\n\n\nconst DAPP_ADDRESS = '...';\n\n\n\nexport const DialectSolanaNotificationsButton = () => {\n\n return (\n\n \n\n {\n\n if (!open) {\n\n return null;\n\n }\n\n return (\n\n
\n\n {children}\n\n
\n\n );\n\n }}\n\n />\n\n
\n\n );\n\n};\n\nPrevious\nCustomizing notifications button\nNext\nUsing standalone notifications component\n\nLast updated 3 months ago", "code_snippets": ["'use client';import '@dialectlabs/react-ui/index.css';import { DialectSolanaSdk } from '@dialectlabs/react-sdk-blockchain-solana';import {Icons,NotificationTypeStyles,NotificationsButton,} from '@dialectlabs/react-ui';const DAPP_ADDRESS = '...';export const DialectSolanaNotificationsButton = () => {return ( {if (!open) {return null;}return (
{children}
);}}/>
);};"] }, { "url": "https://docs.dialect.to/documentation/alerts/alerts-and-monitoring/advancing-react-notifications/styling-notifications-widget", "title": "Styling Notifications widget | Actions & Alerts", "content": "Styling Notifications widget\n\nYou can style the following entities of the notifications component:\n\ncolors\n\nborder radius\n\nfont\n\nmodal container\n\nStyling colors\n\nDialect defines a set of css variables, which are used to color the whole widget:\n\nCopy\n.dialect {\n\n --dt-accent-brand: #09cbbf;\n\n --dt-accent-error: #f62d2d;\n\n --dt-bg-brand: #ebebeb;\n\n --dt-bg-primary: #ffffff;\n\n --dt-bg-secondary: #f9f9f9;\n\n --dt-bg-tertiary: #f2f3f5;\n\n --dt-brand-transparent: #b3b3b31a;\n\n --dt-button-primary: #2a2a2b;\n\n --dt-button-primary-disabled: #656564;\n\n --dt-button-primary-hover: #434445;\n\n --dt-button-secondary: #ebebeb;\n\n --dt-button-secondary-disabled: #f2f3f5;\n\n --dt-button-secondary-hover: #f2f3f5;\n\n --dt-icon-primary: #2a2a2b;\n\n --dt-icon-secondary: #888989;\n\n --dt-icon-tertiary: #b3b3b3;\n\n --dt-input-checked: #09cbbf;\n\n --dt-input-primary: #dee1e7;\n\n --dt-input-secondary: #ffffff;\n\n --dt-input-unchecked: #d7d7d7;\n\n --dt-stroke-primary: #dee1e7;\n\n --dt-text-accent: #08c0b4;\n\n --dt-text-inverse: #ffffff;\n\n --dt-text-primary: #232324;\n\n --dt-text-quaternary: #888989;\n\n --dt-text-secondary: #434445;\n\n --dt-text-tertiary: #737373;\n\n}\n\nYou can override this variables just as any other css variables and specify any other color, or you can reference any other variable in your existing styles, like this:\n\nCopy\n.dialect {\n\n --dt-bg-primary: #ff00ff; /* make sure your css is imported after the dialect styles */\n\n --dt-bg-secondary: #ff00ff !important; /* You might want to add !important tag to avoid css import ordering issue */\n\n --dt-bg-tertiary: var(--my-cool-background); /* You can reference you css variable to avoid copy/paste and handle light/dark theme for example */\n\n}\n\nAs an option, you can include dialect styles before your styles by importing it directly in your css file:\n\nCopy\n@import url('@dialectlabs/react-ui/index.css');\n\nUse the following visual guide to style widget. Please note that css variables are prefixed with --dt\n\nAvailable tokens\nSettings screen styling guide\nButtons states\nText fields states\nNotification connect wallet screen styling guide\nNotification feed styling guide\n\nSee Styling different notification types to learn how to style icons/links colors in notifications feed.\n\nForce dark theme\n\nYou can force dark theme for dialect component. For this you can pass theme='dark' prop to dialect components. \n\nCopy\nexport const DialectSolanaNotificationsButton = () => {\n\n return (\n\n \n\n \n\n \n\n );\n\n};\n\nThis would apply a built in dark theme variables:\n\nCopy\n.dialect[data-theme='dark'] {\n\n --dt-accent-brand: #09cbbf;\n\n --dt-accent-error: #ff4747;\n\n --dt-bg-brand: #656564;\n\n --dt-bg-primary: #1b1b1c;\n\n --dt-bg-secondary: #232324;\n\n --dt-bg-tertiary: #2a2a2b;\n\n --dt-brand-transparent: #b3b3b31a;\n\n --dt-button-primary: #ffffff;\n\n --dt-button-primary-disabled: #dee1e7;\n\n --dt-button-primary-hover: #f9f9f9;\n\n --dt-button-secondary: #323335;\n\n --dt-button-secondary-disabled: #434445;\n\n --dt-button-secondary-hover: #383a3c;\n\n --dt-icon-primary: #ffffff;\n\n --dt-icon-secondary: #888989;\n\n --dt-icon-tertiary: #737373;\n\n --dt-input-checked: #09cbbf;\n\n --dt-input-primary: #434445;\n\n --dt-input-secondary: #1b1b1c;\n\n --dt-input-unchecked: #656564;\n\n --dt-stroke-primary: #323335;\n\n --dt-text-accent: #09cbbf;\n\n --dt-text-inverse: #1b1b1c;\n\n --dt-text-primary: #ffffff;\n\n --dt-text-quaternary: #888989;\n\n --dt-text-secondary: #c4c6c8;\n\n --dt-text-tertiary: #888989;\n\n}\nStyling border radius\n\nDialect defines a set of css variables, which are used to configure border radiuses for the widget:\n\nCopy\n.dialect {\n\n --dt-border-radius-xs: 0.375rem;\n\n --dt-border-radius-s: 0.5rem;\n\n --dt-border-radius-m: 0.75rem;\n\n --dt-border-radius-l: 1rem;\n\n}\nStyling font\n\nFont should inherit your in-app css font configuration by default. In case if it didn't happened for some reason, you can override it for .dialect css classname.\n\nStyling modal\n\nYou can customize .dt-modal css class to change the default modal behavior. Here's the default css styles applied to modal window:\n\nCopy\n/* mobile phones */\n\n.dialect .dt-modal {\n\n position: fixed;\n\n right: 0px;\n\n top: 0px;\n\n z-index: 100;\n\n height: 100%;\n\n width: 100%;\n\n}\n\n/* tablet/desktop */\n\n@media (min-width: 640px) {\n\n .dialect .dt-modal {\n\n position: absolute;\n\n top: 4rem;\n\n height: 600px;\n\n width: 420px;\n\n }\n\n}\n\n/* styling */\n\n.dialect .dt-modal {\n\n overflow: hidden;\n\n border-radius: var(--dt-border-radius-l);\n\n border-width: 1px;\n\n border-color: var(--dt-stroke-primary);\n\n}\n\nIf you want to bring your own modal container see:\n\nUsing your own modal component\nPrevious\nUsing development environment\nNext\nOverriding icons\n\nLast updated 2 months ago" }, { "url": "https://docs.dialect.to/documentation/alerts/alerts-and-monitoring/advancing-react-notifications/using-standalone-notifications-component", "title": "Using standalone notifications component | Actions & Alerts", "content": "Using standalone notifications component\n\nIn some rare cases you might want to just use Notifications component without built-in button and modal window. For example you might want to put component statically to the right side of your page. In this case you bring your own logic to display component and your own modal window. You don't need to use .dt-modal css classname in this case.\n\nNotifications component accepts the following properties:\n\nsetOpen - if functions passed, then Notifications component will have a cross in the top right corner\n\nchannels - see \"Customizing notifications channels\" page\n\nCopy\n'use client';\n\n\n\nimport '@dialectlabs/react-ui/index.css';\n\n\n\nimport { DialectSolanaSdk } from '@dialectlabs/react-sdk-blockchain-solana';\n\nimport { Notifications } from '@dialectlabs/react-ui';\n\n\n\nconst DAPP_ADDRESS = '...';\n\n\n\nexport const DialectSolanaNotificationsButton = () => {\n\n return (\n\n \n\n
\n\n /* no modal and no button are rendered */\n\n \n\n
\n\n
\n\n );\n\n};\n\nPrevious\nUsing your own modal component\nNext\nUsing custom wallet adapter\n\nLast updated 3 months ago", "code_snippets": ["'use client';import '@dialectlabs/react-ui/index.css';import { DialectSolanaSdk } from '@dialectlabs/react-sdk-blockchain-solana';import { Notifications } from '@dialectlabs/react-ui';const DAPP_ADDRESS = '...';export const DialectSolanaNotificationsButton = () => {return (
);};"] }, { "url": "https://docs.dialect.to/documentation/alerts/alerts-and-monitoring/advancing-react-notifications/using-custom-wallet-adapter", "title": "Using custom wallet adapter | Actions & Alerts", "content": "Using custom wallet adapter\n\nIn some cases you might want to use a custom wallet adapter instead of @solana/wallet-adapter-react Here's how you can do it:\n\nCopy\n'use client';\n\n\n\nimport '@dialectlabs/react-ui/index.css';\n\n\n\nimport {\n\n DialectSolanaSdk,\n\n Environment,\n\n} from '@dialectlabs/react-sdk-blockchain-solana';\n\nimport {\n\n Icons,\n\n NotificationTypeStyles,\n\n NotificationsButton,\n\n ThemeType,\n\n} from '@dialectlabs/react-ui';\n\nimport { useWallet } from '@solana/wallet-adapter-react';\n\n\n\nconst DAPP_ADDRESS = '...'\n\n\n\nexport const DialectSolanaNotificationsButton = () => {\n\n const wallet = useWallet(); // as an example we'll use solana wallet adapter\n\n \n\n const walletAdapter: DialectSolanaWalletAdapter = useMemo(\n\n () => ({\n\n publicKey: wallet.publicKey, // PublicKey | null\n\n signMessage: wallet.signMessage, // (msg: Uint8Array) => Promise\n\n signTransaction: wallet.signTransaction,// (tx: T) => Promise\n\n }),\n\n [wallet],\n\n );\n\n\n\n return (\n\n \n\n \n\n \n\n );\n\n};\n\nPrevious\nUsing standalone notifications component\nNext\nBroadcast: Building Your Audience\n\nLast updated 3 months ago", "code_snippets": ["'use client';import '@dialectlabs/react-ui/index.css';import {DialectSolanaSdk,Environment,} from '@dialectlabs/react-sdk-blockchain-solana';import {Icons,NotificationTypeStyles,NotificationsButton,ThemeType,} from '@dialectlabs/react-ui';import { useWallet } from '@solana/wallet-adapter-react';const DAPP_ADDRESS = '...'export const DialectSolanaNotificationsButton = () => {const wallet = useWallet();const walletAdapter: DialectSolanaWalletAdapter = useMemo(() => ({publicKey: wallet.publicKey, signMessage: wallet.signMessage,signTransaction: wallet.signTransaction,}),[wallet],);return ();};"] }, { "url": "https://docs.dialect.to/documentation/alerts/alerts-and-monitoring/sdk", "title": "SDK | Actions & Alerts", "content": "SDK\n\nThis section describes how to interact with Dialect via an SDK.\n\nPrevious\nBroadcast: Building Your Audience\nNext\nTypescript\n\nLast updated 3 months ago" }, { "url": "https://docs.dialect.to/documentation/alerts/alerts-and-monitoring/sdk/typescript/installation", "title": "Installation | Actions & Alerts", "content": "Installation\n\nTo start sending notifications with Dialect via it's Typescript SDK, first install @dialectlabs/sdk. This is the same installation as Messaging.\n\nnpm:\n\nCopy\nnpm install @dialectlabs/sdk --save\n\n\n\n# Solana notifications\n\nnpm install @dialectlabs/blockchain-sdk-solana --save\n\n\n\n# Aptos notifications\n\nnpm install @dialectlabs/blockchain-sdk-aptos --save\n\nyarn:\n\nCopy\nyarn add @dialectlabs/sdk\n\n\n\n# Solana notifications\n\nyarn add @dialectlabs/blockchain-sdk-solana\n\n\n\n# Aptos notifications\n\nyarn add @dialectlabs/blockchain-sdk-aptos\nPrevious\nTypescript\nNext\nConfiguration\n\nLast updated 3 months ago" }, { "url": "https://docs.dialect.to/documentation/alerts/alerts-and-monitoring/sdk/typescript", "title": "Typescript | Actions & Alerts", "content": "Typescript\nInstallation\nConfiguration\nManaging addresses\nSubscribing to notifications\nLoad your dapp\nSending Dapp-to-User Messages\nManaging notification types\nPrevious\nSDK\nNext\nInstallation\n\nLast updated 3 months ago" }, { "url": "https://docs.dialect.to/documentation/alerts/alerts-and-monitoring/sdk/typescript/configuration", "title": "Configuration | Actions & Alerts", "content": "Configuration\n\nAll interactions with Dialect are done by first creating an sdk client, with some initial configuration. This configuration specifies:\n\nWhat chains to use, such as Solana or Aptos.\n\nWhat backends to use, including both the Dialect on chain Solana backend (v0), and/or the free, multi-chain Dialect cloud backend (v1).\n\nWhat environment to target, including local-development, development, & production.\n\nIt is recommended that you perform the following actions targeting the Dialect development environment, and only switch to production when you're ready.\n\nPrevious\nInstallation\nNext\nManaging addresses\n\nLast updated 3 months ago" }, { "url": "https://docs.dialect.to/documentation/alerts/alerts-and-monitoring/broadcast-building-your-audience", "title": "Broadcast: Building Your Audience | Actions & Alerts", "content": "Broadcast: Building Your Audience\n\nMany dapps wish to send product updates, community announcements, and other manually-crafted notifications to their users. Dialect offers an administrator dashboard for sending these announcements. Dapp administrators can connect to the dashboard here using your dapp's messaging keypair that you created in the Registering Your Dapp section to use these incredible community building features! \n\nPrevious\nUsing custom wallet adapter\nNext\nSDK\n\nLast updated 3 months ago" }, { "url": "https://docs.dialect.to/documentation/alerts/alerts-and-monitoring/sdk/typescript/subscribing-to-notifications", "title": "Subscribing to notifications | Actions & Alerts", "content": "Subscribing to notifications\n\nDialect allows users to manage subscriptions to receive notifications from dapps to specific addresses they have registered.\n\nAddresses include not just their wallet via the Dialect protocol, but also email, Telegram, & SMS. To learn more about addresses, see the previous section on managing addresses.\n\nA subscription, a linker table between dapps & addresses, is called a dappAddress.This will likely be renamed as it can be misleading.\n\nCreate a subscription\n\nA subscription, or dappAddress must first be created.\n\nCopy\n// Subscribe to receive dapp notifications to address\n\nconst subscription = await sdk.wallet.dappAddresses.create({\n\n addressId: address.id,\n\n enabled: true,\n\n dappPublicKey\n\n})\nEnabling & disabling a subscription\n\nOnce created, a subscription may be enabled or disabled for a given. Disabling a subscription means no notifications will be sent to that address for that dapp until it is reenabled.t\n\nCopy\n// Enable/disable subscription\n\nconst updatedSubscription = await sdk.wallet.dappAddresses.update({\n\n dappAddressId: subscription.id,\n\n enabled: false,\n\n});\nGetting subscriptions\nFind a subscription by its id\nCopy\n// Find specific address subscription owned by wallet\n\nconst specificSubscription = await sdk.wallet.dappAddresses.find({\n\n dappAddressId: subscription.id\n\n});\nFind subscriptions by wallet (& optionally filter by dapp)\nCopy\n// Find all address subscriptions owned by wallet and optionally filtering\n\n// by dapp or address ids.\n\nconst allSubscriptions = await sdk.wallet.dappAddresses.findAll({\n\n dappPublicKey, // optional parameter\n\n addressIds: [address.id] // optional parameter\n\n});\nDeleting a subscription\nCopy\n// Delete subscription\n\nawait sdk.wallet.dappAddresses.delete({\n\n dappAddressId: subscription.id\n\n})\nPrevious\nManaging addresses\nNext\nLoad your dapp\n\nLast updated 3 months ago" }, { "url": "https://docs.dialect.to/documentation/alerts/alerts-and-monitoring/sdk/typescript/managing-addresses", "title": "Managing addresses | Actions & Alerts", "content": "Managing addresses\n\nDialect supports not only messaging via its web3 protocol, but also via email, Telegram, & SMS. Users manage addresss via the Dialect data service, where they may add, verify, update & remove addresses on file for these various channels.\n\nAdd a new address\nCopy\nconst address = await sdk.wallet.addresses.create({\n\n type: AddressType.Email,\n\n value: 'address@mailservice.com',\n\n});\nVerify an address\n\nDialect uses verification codes to verify ownership of a web2 channel such as email, Telegram or SMS. These codes are sent to the address in question.\n\nCopy\n// Verify address (email telegram or phone number). Constraint: there are\n\n// 3 attempts to verify address, otherwise use call below to send new\n\n// verification code\n\nconst verifiedAddress = await sdk.wallet.addresses.verify({\n\n addressId: address.id,\n\n code: '1337',\n\n});\n\nIf you did not receive the verification code, or if you failed to enter the correct value after several attempts, you can send a new code via the following call:\n\nCopy\n// Resend verification code. Constraint: you must wait 60 sec before\n\n// resending the code.\n\nawait sdk.wallet.addresses.resendVerificationCode({\n\n addressId: address.id,\n\n});type\nGet addresses owned by a wallet\nCopy\n// Find all addresses owned by wallet\n\nconst allAddresses = await sdk.wallet.addresses.findAll();\n\n\n\n// Find specific address owned by wallet\n\nconst specificAddress = await sdk.wallet.addresses.find({\n\n addressId: address.id,\n\n});\nUpdate an address\n\nYou can update an address on file at any time. All of your subscriptions will remain intact, but won't be sent until you re-verify.\n\nCopy\n// Update address value\n\nconst updatedAddress = await sdk.wallet.addresses.update({\n\n addressId: address.id,\n\n value: 'updated.address@example.com',\n\n});\nRemove an address\n\nYou can delete an address on file at any time. This will remove all subscriptions associated with that address.\n\nCopy\n// Delete address\n\nawait sdk.wallet.addresses.delete({\n\n addressId: address.id,\n\n});\nPrevious\nConfiguration\nNext\nSubscribing to notifications\n\nLast updated 3 months ago" } ]