1.1.27 • Published 9 months ago

@metaworklabs/macha-dev-sdk v1.1.27

Weekly downloads
-
License
ISC
Repository
-
Last release
9 months ago

Macha SDK

This SDK can be used to connect and access data from multiple protocols without separatly integrating each one of them.

Introduction

Macha dev sdk can be used for interacting with multiple protocols to access data or perform actions on them without individually integrating them in your application.

This allows developers to have the flexibility to perform inter-protocol operations i.e. having different source and triggers on either same or multiple protocols.

Under the hood the SDK uses

  • Typescript
  • ethers.js
  • Graph and GraphQL

Getting Started

Installing Packages

To get started with using Macha SDK, you can install it with npm or yarn

npm install @metaworklabs/macha-dev-sdk

yarn add @metaworklabs/macha-dev-sdk

Usage

Initializing

  • clientId - address of the client of whose metas you need to access
  • signer - wallet signer object
  • metas - list of all enabled metas owned by the clientId
import { Macha, Meta } from '@metaworklabs/macha-dev-sdk/lib';
import {ethers} from "ethers";

const signer: ethers.Signer = signer; // getting from your wallet

const client = new Macha({owner:clientId , signer: signer});

// get enabled metas from the Client.
const metas = client.client?.metasEnabled?.data;

Executing

// executing meta origins
const meta = new Meta(metaId);
const response = await meta.fetchMetaOrigin(requestParams, originIndex);

// trigger
const responseTrigger = await meta.triggerMeta(requestParams, triggerIndex);

Platform Supported

  • React.Js, Next.Js, React Native

Input schema for Meta Creation

{
    id: "",
    name: "Mint Kudos",
    description: "Returns a list of wallet token objects for the specified address.",
    image: "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy",
    clientId: "0x4eff290c1a734411b39aaa96eabe1e25f0e223ae",
    triggers: {
        "1": {
        id: "1",
        slug: "qwertyuiop123",
        name: "sample_trigger_1",
        description: "This is a sample trigger 1",
        requestType: "CONTRACT",
        requestMethod: "updatePing",
        requestEndpoint:
            "0x66290530D75bB75cbD92e7cF07ef76B8D367f328",
        requestParams: {
            title: "Trigger_params_1",
            type: "object",
            properties: {
            id: {
                type: "string",
            },
            name: {
                type: "string",
            },
            age: {
                type: "integer",
                minimum: 0,
            },
            },
            additionalProperties: false,
            required: ["id", "name"],
        },
        requestSchema: [], // Contract -> ABI, Graph -> Query, REST -> URL
        requestSchemaCid: "",
        responseSuccess: {},
        responseError: {},
        },
        "2": {
        id: "2",
        slug: "iyuriuw",
        name: "sample_trigger_2",
        description: "This is a sample trigger 2",
        requestType: "CONTRACT",
        requestMethod: "accountDetails",
        requestEndpoint:
            "0x66290530D75bB75cbD92e7cF07ef76B8D367f328",
        requestParams: {
            title: "Trigger_params",
            type: "object",
            properties: {
            firstName: {
                type: "string",
            },
            lastName: {
                type: "string",
            },
            age: {
                type: "integer",
                minimum: 0,
            },
            },
            additionalProperties: false,
            required: ["firstName", "lastName"],
        },
        requestSchema: [],
        requestSchemaCid: "",
        responseSuccess: {},
        responseError: {},
        },
    },
    origin: {
        requestType: "REST",
        requestMethod: "GET",
        requestEndpoint: "https://api.mintkudos.xyz/v1/wallets/{{address}}/tokens",
        requestParams: {
        address: "string",
        },
        requestSchema:"",
        requestSchemaCid: "",
        requestHeaders: {},
    },
    source: {
        network: "hyperspace",
        chainId: "3141",
        contractAddress: "0xAC6E98027A0bDE7d8c2EAe94427593dc25fc63F4",
    },
    prevIpfsCid: "",
    mapping: {},
}
1.1.16

9 months ago

1.1.15

9 months ago

1.1.19

9 months ago

1.1.18

9 months ago

1.1.17

9 months ago

1.1.22

9 months ago

1.1.21

9 months ago

1.1.20

9 months ago

1.1.27

9 months ago

1.1.26

9 months ago

1.1.25

9 months ago

1.1.24

9 months ago

1.1.14

10 months ago

1.1.12

11 months ago

1.1.11

11 months ago

1.1.10

11 months ago

1.1.9

11 months ago

1.1.8

11 months ago

1.1.7

11 months ago

1.1.6

11 months ago

1.1.5

12 months ago

1.1.2

12 months ago

1.1.1

12 months ago

1.1.0

12 months ago

1.0.20

12 months ago

1.0.19

12 months ago

1.0.18

12 months ago

1.0.17

12 months ago

1.0.16

12 months ago

1.0.15

12 months ago

1.0.14

12 months ago

1.0.13

12 months ago

1.0.12

12 months ago

1.0.11

12 months ago

1.0.10

12 months ago

1.0.9

12 months ago

1.0.8

12 months ago

1.0.7

12 months ago

1.0.6

12 months ago

1.0.5

12 months ago

1.0.4

12 months ago

1.0.3

12 months ago

1.0.2

12 months ago

1.0.1

1 year ago

1.0.0

1 year ago