Skip to content

decentldotland/mem-kwil-ext

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@decentldotland/mem-kwil-ext

Kwil Extension for the MEM protocol

Build Locally

git clone https://github.com/decentldotland/mem-kwil-ext.git

cd mem-sdk

npm install && npm run build

docker build -t mem_kwil .

About

The mem-kwil-ext is a Kwil Extension designed to enable the utilization of MEM serverless functions within Kwil SQL databases. In its present iteration, this extension exclusively facilitates MEM write operations from a Kwil DB.

It offers support for both MEM's mainnet and testnet RPCs, along with MEM Named Functions resolution. The primary method employed by the extension is write(), which accepts the MEM Input object in a stringified JSON format.

Usage

In this Kuneiform database example, we import the mem_kwil extension as mem, then submit a write interaction to the ans.mem MEM function. The extension method returns the MEM TXID in case the interaction succeeds.

database mem_kwil_test;

use mem_kwil {
    network: 'mainnet',
    function_id: 'ans.mem'
} as mem;

table reqs {
    txid text primary notnull
}

action writeMem() public {
    $txid = mem.write('{"function": "mint", "domain": "memkwilext"}');
    INSERT INTO reqs
    VALUES($txid);
}

License

This repository is licensed under the MIT License