-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(sdk): add initial base structure
- Loading branch information
Showing
23 changed files
with
583 additions
and
13 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
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 @@ | ||
export * from "./dist/index"; |
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,12 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Vite + TS</title> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<script type="module" src="/src/main.ts"></script> | ||
</body> | ||
</html> |
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,24 @@ | ||
{ | ||
"name": "@ordzaar/ordit-sdk-browser-tests", | ||
"version": "0.0.0", | ||
"description": "SDK tests for simplified interaction with wallet APIs and inscription service", | ||
"license": "MIT", | ||
"types": "./dist/index.d.ts", | ||
"files": [ | ||
"dist" | ||
], | ||
"keywords": [ | ||
"ordit", | ||
"ordit-sdk", | ||
"sdk" | ||
], | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "tsc && vite build", | ||
"build:watch": "tsc && vite build --watch", | ||
"preview": "vite preview" | ||
}, | ||
"dependencies": { | ||
"@ordzaar/ordit-sdk": "workspace:*" | ||
} | ||
} |
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 @@ | ||
async function main() { | ||
const appRoot = document.getElementById("app"); | ||
|
||
if (!appRoot) { | ||
return; | ||
} | ||
|
||
appRoot.innerHTML = "Browser Test"; | ||
} | ||
|
||
main(); |
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 @@ | ||
/// <reference types="vite/client" /> |
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,27 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/tsconfig", | ||
"display": "Default", | ||
"compilerOptions": { | ||
"lib": ["DOM", "DOM.Iterable", "ESNext"], | ||
"module": "ESNext", | ||
"target": "ESNext", | ||
"strict": true, | ||
"esModuleInterop": true, | ||
"skipLibCheck": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"moduleResolution": "node", | ||
"composite": false, | ||
"declaration": true, | ||
"declarationMap": true, | ||
"inlineSources": false, | ||
"isolatedModules": true, | ||
"noUnusedLocals": false, | ||
"noUnusedParameters": false, | ||
"preserveWatchOutput": true, | ||
"rootDir": "./", | ||
"outDir": "./dist", | ||
"sourceMap": true | ||
}, | ||
"include": ["./src", "./tests", "./src/types"], | ||
"exclude": ["node_modules", "dist"] | ||
} |
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
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 @@ | ||
export * from "./dist/browser-wallets/index"; |
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 @@ | ||
export * from "./dist/index"; |
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
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,2 @@ | ||
export { wallet as unisat } from "./unisat"; | ||
export { wallet as xverse } from "./xverse"; |
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,6 @@ | ||
export interface BrowserWallet { | ||
isInstalled: () => Promise<boolean>; | ||
getAddresses: () => Promise<void>; | ||
signPsbt: () => Promise<void>; | ||
signMessage: () => Promise<void>; | ||
} |
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,20 @@ | ||
import { BrowserWallet } from "../types"; | ||
|
||
async function isInstalled() { | ||
return false; | ||
} | ||
|
||
async function getAddresses() {} | ||
|
||
async function signPsbt() {} | ||
|
||
async function signMessage() {} | ||
|
||
const wallet: BrowserWallet = { | ||
isInstalled, | ||
getAddresses, | ||
signPsbt, | ||
signMessage, | ||
}; | ||
|
||
export { wallet }; |
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,20 @@ | ||
import { BrowserWallet } from "../types"; | ||
|
||
async function isInstalled() { | ||
return false; | ||
} | ||
|
||
async function getAddresses() {} | ||
|
||
async function signPsbt() {} | ||
|
||
async function signMessage() {} | ||
|
||
const wallet: BrowserWallet = { | ||
isInstalled, | ||
getAddresses, | ||
signPsbt, | ||
signMessage, | ||
}; | ||
|
||
export { wallet }; |
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,6 @@ | ||
import type { BrowserWallet } from "./browser-wallets/types"; | ||
export type { BrowserWallet }; | ||
|
||
const SDK_NAME = "ORDIT_SDK"; | ||
|
||
export { SDK_NAME }; |
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,23 @@ | ||
declare interface Window { | ||
unisat: Unisat; | ||
ethereum: MetaMask; | ||
} | ||
|
||
type UnisatNetwork = "livenet" | "testnet"; | ||
|
||
type Unisat = { | ||
getNetwork: () => Promise<UnisatNetwork>; | ||
switchNetwork: (targetNetwork: UnisatNetwork) => Promise<void>; | ||
requestAccounts: () => Promise<string[]>; | ||
getPublicKey: () => Promise<string>; | ||
signPsbt: ( | ||
hex: string, | ||
{ autoFinalized }: Record<string, boolean>, | ||
) => Promise<string>; | ||
signMessage: (message: string) => Promise<string>; | ||
}; | ||
|
||
type MetaMask = { | ||
isMetaMask: boolean; | ||
request: (options: { method: string; params?: any }) => Promise<any>; | ||
}; |
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
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,28 @@ | ||
import { resolve } from "path"; | ||
import { defineConfig } from "vite"; | ||
import dts from "vite-plugin-dts"; | ||
import * as packageJson from "./package.json"; | ||
|
||
export default defineConfig({ | ||
build: { | ||
outDir: "dist", | ||
lib: { | ||
entry: { | ||
index: resolve(__dirname, "src/index.ts"), | ||
"browser-wallets": resolve(__dirname, "src/browser-wallets/index.ts"), | ||
}, | ||
formats: ["es", "cjs"], | ||
}, | ||
rollupOptions: { | ||
external: Object.keys(packageJson.dependencies), | ||
}, | ||
commonjsOptions: { | ||
include: [/node_modules/], | ||
}, | ||
}, | ||
plugins: [ | ||
dts({ | ||
insertTypesEntry: true, | ||
}), | ||
], | ||
}); |
Oops, something went wrong.