Code Monkey home page Code Monkey logo

memo's Introduction

Memo Program!

Send a transfer between two accounts with a memo to remind you about why you made a transaction. The actual program is deployed on the devnet currently. This repo has a js client you can use, and a demo that you can spin up (basic nexjs app to interface with the client).

Demo: https://memo-1zeh8izw6-strangemood.vercel.app/

Usage

Using @strangemood/memo

import {
  getLastMemos,
  getMemoAccountForPubkey,
  getMemoProvider,
  transferWithMemo,
} from "@strangemood/memo";

const currentWalletMemoAccount = getMemoAccountForPubkey(
  `wallet address of a user, likely the current authed user`
);

RPC Directly

import * as anchor from "@project-serum/anchor";
import { memoIDL, DEVNET } from "@strangemood/memo";

// get connection and wallet however you'd like... you can look at inspo in demo/MemoExample.tsx

const provider = new anchor.Provider(connection, wallet);
const program = new anchor.Program(idl, DEVNET.MEMO_PROGRAM_ID, provider);
const tx = await program.rpc.memoTransfer(
  utf8encodedMemo,
  new anchor.BN(transferData.amount),
  {
    accounts,
  }
);

Deploying Memo Program

To use the program it needs to be deployed. This is currently running on the devnet but can be deployed on mainnet whenever.

  1. Building and Deploying:

anchor build anchor deploy

  1. Running the build command above, generates an updated idl file. This is managed by Anchor and helps in building the JS client. To make sure the JS client is using a compatible interface to the program on chain, copy the target/idl/memo.json file into client/src/memo.json.

Developing

Create a local symlink so you can develop without new npm publishing.

  1. cd client, yarn build, yarn link

  2. cd demo, yarn link @strangemood/memo

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.