Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12,889 changes: 3,304 additions & 9,585 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

46 changes: 46 additions & 0 deletions wallets/eightsaf-extension/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# @interchain-kit/eightsaf-extension

EightSaf browser extension wallet adapter for [Interchain Kit](https://github.com/hyperweb-io/interchain-kit).

EightSaf is a non-custodial wallet for [Safrochain](https://safrochain.com). This package connects dApps to `window.eightsaf` using the standard Interchain Kit wallet interface (connect, sign, broadcast).

## Install

```sh
npm install @interchain-kit/eightsaf-extension @interchain-kit/react
```

## Usage

Import Safrochain from `chain-registry` when your installed version includes it (see [chain-registry safrochain](https://github.com/hyperweb-io/chain-registry/blob/main/v2/packages/chain-registry/src/mainnet/safrochain/chain.ts)). Otherwise provide chain and asset metadata that matches the network selected in the user's EightSaf extension.

```tsx
import { ChainProvider } from '@interchain-kit/react';
import { eightsafWallet } from '@interchain-kit/eightsaf-extension';
import { chain as safrochainChain, assetList as safrochainAssetList } from 'chain-registry/mainnet/safrochain';

export function App() {
return (
<ChainProvider
chains={[safrochainChain]}
assetLists={[safrochainAssetList]}
wallets={[eightsafWallet]}
>
{/* your app */}
</ChainProvider>
);
}
```

### Testnet

Use `safrochain-testnet-1` when the extension is set to Safrochain Testnet. Import testnet chain data from `chain-registry` when available, or define it manually to match your extension network.

## Requirements

- [EightSaf extension](https://chromewebstore.google.com/detail/eightsaf-wallet/hpemogcffkhcoegjbphljmbjepibnpjj) installed (Chrome or [Firefox](https://addons.mozilla.org/en-US/firefox/addon/eightsaf-wallet/))
- Chain ID in your dApp config must match the network active in the extension (`safrochain-1` or `safrochain-testnet-1`)

## How it works

The adapter detects EightSaf via `window.eightsaf` and delegates to the standard `CosmosWallet` implementation (`enable`, `getKey`, `signAmino`, `signDirect`, `sendTx`, etc.).
25 changes: 25 additions & 0 deletions wallets/eightsaf-extension/__tests__/first.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { eightsafWallet } from '../src';

describe('EightSaf extension', () => {
it('exposes correct wallet metadata', () => {
expect(eightsafWallet.info.name).toBe('eightsaf-extension');
expect(eightsafWallet.info.prettyName).toBe('EightSaf');
expect(eightsafWallet.info.mode).toBe('extension');
expect(eightsafWallet.info.windowKey).toBe('eightsaf');
expect(eightsafWallet.info.cosmosKey).toBe('eightsaf');
expect(eightsafWallet.info.keystoreChange).toBe('eightsaf_keystorechange');
expect(eightsafWallet.info.walletIdentifyKey).toBe('eightsaf.isEightSaf');
expect(eightsafWallet.info.downloads).toEqual(
expect.arrayContaining([
expect.objectContaining({
browser: 'chrome',
link: 'https://chromewebstore.google.com/detail/eightsaf-wallet/hpemogcffkhcoegjbphljmbjepibnpjj',
}),
expect.objectContaining({
browser: 'firefox',
link: 'https://addons.mozilla.org/en-US/firefox/addon/eightsaf-wallet/',
}),
]),
);
});
});
18 changes: 18 additions & 0 deletions wallets/eightsaf-extension/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
transform: {
'^.+\\.tsx?$': [
'ts-jest',
{
babelConfig: false,
tsconfig: 'tsconfig.json',
},
],
},
transformIgnorePatterns: [`/node_modules/*`],
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
modulePathIgnorePatterns: ['dist/*']
};
45 changes: 45 additions & 0 deletions wallets/eightsaf-extension/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"name": "@interchain-kit/eightsaf-extension",
"version": "0.10.2",
"author": "EightSaf Team",
"description": "EightSaf browser extension wallet adapter for Interchain Kit",
"main": "index.js",
"module": "esm/index.js",
"types": "index.d.ts",
"homepage": "https://github.com/hyperweb-io/interchain-kit",
"license": "MIT",
"publishConfig": {
"access": "public",
"directory": "dist"
},
"repository": {
"type": "git",
"url": "https://github.com/hyperweb-io/interchain-kit"
},
"bugs": {
"url": "https://github.com/hyperweb-io/interchain-kit/issues"
},
"scripts": {
"clean": "makage clean",
"build": "makage build",
"build:dev": "npm run clean; tsc --declarationMap; tsc -p tsconfig.esm.json; npm run copy",
"lint": "eslint . --fix",
"test": "jest",
"test:watch": "jest --watch",
"watch:dev": "tsc -w -p tsconfig.esm.json & tsc -w",
"prepack": "npm run build"
},
"keywords": [
"eightsaf",
"safrochain",
"cosmos",
"wallet",
"interchain-kit"
],
"dependencies": {
"@interchain-kit/core": "workspace:*"
},
"devDependencies": {
"makage": "^0.1.12"
}
}
3 changes: 3 additions & 0 deletions wallets/eightsaf-extension/src/constant.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// EightSaf brand logo from eightsaf/public/eightsaf-icon.svg
export const ICON =
'data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIGlkPSJDYWxxdWVfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiIHZpZXdCb3g9IjAgMCAzMDAgMzE5LjUiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXwgMCAwIDMwMCAzMTkuNTsiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+IC5zdDB7ZmlsbDojMDUzMUFBO30gLnN0MXtmaWxsOiMwMzI5QUY7fSA8L3N0eWxlPjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik0xMDUuNiwzNS40YzAtMy4zLDAuNS02LjUsMS4zLTkuNWM0LjEtMTQuOSwxNy44LTI1LjgsMzQtMjUuOGMxNC42LD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2xhc3M9InN0MSIgZD0iTTIwMC4xLDMxMWMtMTUuNyw1LjUtMzIuNiw4LjYtNTAuMSw4LjZjLTgyLjksMC0xNTAtNjcuMS0xNTAtMTUwYzAtNTQuMiwyOC43LTEwMS42LDcxLjgtMTI4IGMxLjUsMTguMSw5LjgsMzQuMiwyMi4yLDQ1LjljLTI3LjYsMTguMi00NS44LDQ5LjUtNDUuOCw4NWMwLDUyLjEsMzksOTQuOSw4OS4zLDEwMS4xYzQuMSwwLjYsOC4yLDAuOCwxMi41LDAuOCBjMTIuNCwwLDI0LjItMi4yLDM1LjEtNi4zYy0wLjEsMS4xLTAuMSwyLjItMC4xLDMuM2MwLDcuNCwxLjMsMTQuNCwzLjgsMjAuOUMxOTEuNCwyOTkuMiwxOTUuMywzMDUuNSwyMDAuMSwzMTF6Ii8+PHBhdGggY2xhc3M9InN0MSIgZD0iTTMwMCwxNjkuNmMwLDIxLjgtNC42LDQyLjUtMTIuOSw2MS4xYy00LjItNC41LTktOC4yLTE0LjUtMTEuMWMtOC40LTQuNi0xOC4xLTcuMi0yOC4zLTcuMmgtMC41IGM1LjItMTIuMiw4LjEtMjUuNiw4LjEtMzkuOGMwLTMuMS0wLjEtNi4yLTAuNC05LjJjLTMuMS0zNS4zLTI0LjMtNjUuNC01NC4zLTgxLjFjMTAuOS0xMi42LDE3LjUtMjguOSwxNy41LTQ2LjkgYzAtMC40LDAtMC44LTAuMS0xLjJDMjY1LjEsNTguMywzMDAsMTA5LjgsMzAwLDE2OS42eiIvPjwvZz48L3N2Zz4=';
11 changes: 11 additions & 0 deletions wallets/eightsaf-extension/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { CosmosWallet, ExtensionWallet } from '@interchain-kit/core';

import { eightsafExtensionInfo } from './registry';

export * from './registry';

const eightsafWallet = new ExtensionWallet(eightsafExtensionInfo);

eightsafWallet.setNetworkWallet('cosmos', new CosmosWallet(eightsafExtensionInfo));

export { eightsafWallet };
30 changes: 30 additions & 0 deletions wallets/eightsaf-extension/src/registry.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { Wallet } from '@interchain-kit/core';

import { ICON } from './constant';

export const eightsafExtensionInfo: Wallet = {
name: 'eightsaf-extension',
prettyName: 'EightSaf',
logo: ICON,
mode: 'extension',
windowKey: 'eightsaf',
cosmosKey: 'eightsaf',
walletIdentifyKey: 'eightsaf.isEightSaf',
keystoreChange: 'eightsaf_keystorechange',
description: 'Non-custodial browser extension wallet for Safrochain',
downloads: [
{
device: 'desktop',
browser: 'chrome',
link: 'https://chromewebstore.google.com/detail/eightsaf-wallet/hpemogcffkhcoegjbphljmbjepibnpjj',
},
{
device: 'desktop',
browser: 'firefox',
link: 'https://addons.mozilla.org/en-US/firefox/addon/eightsaf-wallet/',
},
{
link: 'https://eightsaf.io',
},
],
};
9 changes: 9 additions & 0 deletions wallets/eightsaf-extension/tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "dist/esm",
"module": "es2022",
"rootDir": "src/",
"declaration": false
}
}
14 changes: 14 additions & 0 deletions wallets/eightsaf-extension/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "dist",
"rootDir": "src/",
"baseUrl": ".",
"paths": {
"@interchain-kit/core": ["../../packages/core/dist"],
"@interchain-kit/core/*": ["../../packages/core/dist/*"]
}
},
"include": ["src/**/*.ts"],
"exclude": ["dist", "node_modules", "**/*.spec.*", "**/*.test.*"]
}