-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 5a629cb
Showing
21 changed files
with
10,002 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"env": { | ||
"node": true, | ||
"es2021": true | ||
}, | ||
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:prettier/recommended"], | ||
"rules": { | ||
"unused-imports/no-unused-imports-ts": "error", | ||
"@typescript-eslint/consistent-type-imports": "error" | ||
}, | ||
"ignorePatterns": ["node_modules/", ".github/", "dist/"], | ||
"plugins": ["unused-imports", "@typescript-eslint", "prettier"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules | ||
dist | ||
.env | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
src/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"tabWidth": 2, | ||
"printWidth": 120, | ||
"trailingComma": "all", | ||
"singleQuote": true, | ||
"semi": false, | ||
"endOfLine": "auto" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2022-2024 Keyper Labs | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
# Palmera | ||
|
||
[![npm Version](https://badge.fury.io/js/%40keyper-labs%2Fpalmera-module-sdk.svg)](https://badge.fury.io/js/%40keyper-labs%2Fpalmera-module-sdk) | ||
[![GitHub Release](https://img.shields.io/github/release/keyper-labs/palmera-module-sdk.svg?style=flat)](https://github.com/keyper-labs/palmera-module-sdk/releases) | ||
[![GitHub](https://img.shields.io/github/license/keyper-labs/palmera-module-sdk)](https://github.com/keyper-labs/palmera-module-sdk/blob/main/LICENSE.md) | ||
|
||
Software development kit that facilitates the interaction with [Palmera Module](https://docs.palmeradao.xyz/palmera-module-safe-hierarchical-structure) using a TypeScript interface. This Kit can be used to create on chain organizations, create and execute transactions on behalf, and much more. | ||
|
||
## Table of contents | ||
|
||
- [Documentation](#documentation) | ||
- [Installation](#installation) | ||
- [Quick Start](#quick-start) | ||
- [Need Help or Have Questions?](#need-help-or-have-questions) | ||
- [License](#license) | ||
|
||
## Documentation | ||
|
||
Head to the [Palmera SDK docs](https://github.com/keyper-labs/palmera-module-sdk/blob/main/Palmera.md) to learn more about this SDK. | ||
|
||
## Installation | ||
|
||
Install the package with yarn or npm: | ||
|
||
```bash | ||
yarn add @keyper-labs/palmera-module-sdk | ||
npm install @keyper-labs/palmera-module-sdk | ||
``` | ||
|
||
## Quick Start | ||
|
||
### 1. Create a Palmera instance | ||
|
||
There are two ways to create a Palmera instance. | ||
|
||
#### a. Initialize with an existing Safe intance | ||
|
||
Using an existing Safe instance, you can initialize a Palmera SDK instance. | ||
|
||
```js | ||
import Safe from '@safe-global/protocol-kit' | ||
import Palmera from '@keyper-labs/palmera-module-sdk' | ||
|
||
const protocolKit = await Safe.create({ | ||
ethAdapter, | ||
safeAddress, | ||
}) | ||
|
||
const palmeraSdk = await Palmera.init(protocolKit) | ||
``` | ||
|
||
#### b. Create using a SafeConfig | ||
|
||
Using an ethAdapter and a Safe address, the Palmera SDK will create a Safe instance internally and return a new Palmera instance. | ||
|
||
```js | ||
import Palmera from '@keyper-labs/palmera-module-sdk' | ||
|
||
const palmeraSdk = await Palmera.create({ | ||
ethAdapter, | ||
safeAddress, | ||
}) | ||
``` | ||
|
||
### 2. Prepare your Safe | ||
|
||
You need to enable Palmera module and set Palmera Guard in order to create a new organization in Palmera | ||
|
||
```js | ||
const tx = await palmeraSDK.setUpSafeTx() | ||
const result = await safeSDK.executeTransaction(tx) | ||
``` | ||
|
||
### 3. Create your first organization | ||
|
||
Create and execute a Safe transaction to register your new organization. This requires an organization name, which can be something that describes your organization or a random name. | ||
|
||
```js | ||
const tx = await palmeraSDK.registerOrganizationTx('Some name') | ||
const result = await safeSDK.executeTransaction(tx) | ||
``` | ||
|
||
Let's confirm your first organization and retrieve the org hash from the Safe address. | ||
|
||
```js | ||
const isRegistered = await palmeraSDK.isOrganizationRegistered() | ||
const orgHash = await palmeraSdk.getOrgHashBySafe(safeAddress) | ||
``` | ||
|
||
## Need Help or Have Questions? (WIP) | ||
|
||
If you have any doubts, questions, or need assistance, feel free to reach out! [Here you will find how to get support.](https://t.me/palmera_support) | ||
|
||
## License | ||
|
||
This library is [released under MIT](https://github.com/keyper-labs/palmera-module-sdk/blob/main/LICENSE.md). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import globals from "globals"; | ||
import pluginJs from "@eslint/js"; | ||
import tseslint from "typescript-eslint"; | ||
|
||
|
||
export default [ | ||
{files: ["**/*.{js,mjs,cjs,ts}"]}, | ||
{languageOptions: { globals: globals.browser }}, | ||
pluginJs.configs.recommended, | ||
...tseslint.configs.recommended, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
{ | ||
"name": "@keyper-labs/palmera-module-sdk", | ||
"version": "0.2.6", | ||
"description": "Palmera module sdk", | ||
"main": "dist/src/index.js", | ||
"typings": "dist/src/index.d.ts", | ||
"scripts": { | ||
"lint": "eslint src/**/*.ts", | ||
"build": "rm -r ./dist & tsc", | ||
"build:hardhat": "npx hardhat clean && npx hardhat compile", | ||
"hardhat": "npx hardhat", | ||
"node": "npx hardhat node", | ||
"test": "npx hardhat test", | ||
"docs": "jsdoc2md ./dist/src/Palmera.js > ./Palmera.md" | ||
}, | ||
"author": "Keyper Labs (https://palmeradao.xyz)", | ||
"license": "MIT", | ||
"files": [ | ||
"dist" | ||
], | ||
"homepage": "https://palmeradao.xyz", | ||
"keywords": [ | ||
"Ethereum", | ||
"Safe", | ||
"Palmera", | ||
"DAO", | ||
"SDK" | ||
], | ||
"devDependencies": { | ||
"@eslint/js": "^9.9.1", | ||
"@nomicfoundation/hardhat-chai-matchers": "^2.0.7", | ||
"@nomicfoundation/hardhat-ethers": "^3.0.6", | ||
"@nomicfoundation/hardhat-foundry": "^1.1.2", | ||
"@nomicfoundation/hardhat-ignition": "^0.15.5", | ||
"@nomicfoundation/hardhat-ignition-ethers": "^0.15.5", | ||
"@nomicfoundation/hardhat-network-helpers": "^1.0.11", | ||
"@nomicfoundation/hardhat-toolbox": "^5.0.0", | ||
"@nomicfoundation/hardhat-verify": "^2.0.9", | ||
"@nomicfoundation/ignition-core": "^0.15.5", | ||
"@safe-global/safe-core-sdk-types": "^4.0.2", | ||
"@typechain/ethers-v6": "^0.5.1", | ||
"@typechain/hardhat": "^9.1.0", | ||
"@types/chai": "^4.3.17", | ||
"@types/mocha": "^10.0.7", | ||
"@types/node": "^22.4.1", | ||
"chai": "^4.5.0", | ||
"eslint": "^9.9.1", | ||
"globals": "^15.9.0", | ||
"hardhat": "^2.22.8", | ||
"hardhat-contract-sizer": "^2.10.0", | ||
"hardhat-gas-reporter": "^1.0.10", | ||
"jsdoc-to-markdown": "^9.0.2", | ||
"prettier": "^3.3.3", | ||
"solidity-coverage": "^0.8.12", | ||
"ts-node": "^10.9.2", | ||
"typechain": "^8.3.2", | ||
"typescript": "^5.4.5", | ||
"typescript-eslint": "^8.3.0" | ||
}, | ||
"dependencies": { | ||
"@safe-global/api-kit": "^2.3.2", | ||
"@safe-global/protocol-kit": "^3.1.1", | ||
"abitype": "1.0.2", | ||
"dotenv": "^16.4.5", | ||
"ethers": "^6.13.2", | ||
"viem": "^2.20.0" | ||
} | ||
} |
Oops, something went wrong.