Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
c7f4b2a
throw contractKey error
kingsleydon Apr 25, 2022
a50ebce
feat: expose pruntimeApi
kingsleydon Jun 23, 2022
2c388b9
fix(example): use static export
kingsleydon Jun 28, 2022
0894200
fix deps
kingsleydon Jun 28, 2022
8607bd2
chore: upgrade deps
kingsleydon Sep 20, 2022
ad12f74
fix: polkadot api compatibility
kingsleydon Sep 20, 2022
9c4ae39
chore: update proto
kingsleydon Sep 28, 2022
ab074ed
chore: bump polkadot js
kingsleydon Nov 8, 2022
fbc69f7
feat: sidevmQuery
kingsleydon Sep 30, 2022
17d72ae
chore: patch ContractExecResult
kingsleydon Nov 9, 2022
e08a938
fix: ContractExecResultV2
kingsleydon Nov 9, 2022
0e75903
fix: add missed WeightV2 definition. (#18)
Leechael Nov 9, 2022
6c92c9e
bump version
kingsleydon Nov 9, 2022
6e602e4
fix: Compact<u64> and unwrap.
Leechael Nov 9, 2022
9f4dcaa
bump version
Leechael Nov 9, 2022
03f66cd
fix: refer refTime instead of proofSize.
Leechael Nov 10, 2022
2634df4
bump version
Leechael Nov 10, 2022
ecdb630
chore: bump polkadot js
Leechael Nov 14, 2022
386042c
build: remove publish action from release edit event.
Leechael Nov 14, 2022
d1d6d26
bump version
Leechael Nov 14, 2022
f12558d
chore: bump polkadot js
Leechael Nov 14, 2022
a7a9124
bump version
Leechael Nov 14, 2022
a5e12fd
fix: remove hotfix for polkadot-js WeightV2
Leechael Nov 14, 2022
b7de971
bump version
Leechael Nov 14, 2022
9013ab8
feat: type declaration for contracts & clusters query
Leechael Nov 15, 2022
422eca1
fix: gitignore for proto directory.
Leechael Nov 15, 2022
cb3a088
feat: drafting supports for gasFee by @kvinwang
Leechael Nov 15, 2022
193eaab
bump version
Leechael Nov 15, 2022
7c3873e
fix: typing for instantiate
Leechael Nov 24, 2022
fb079f7
bump version
Leechael Nov 24, 2022
0ff37e4
Merge pull request #20 from Phala-Network/15-support-sidevm-query
Leechael Dec 15, 2022
449abf4
bugfix: flipper flip method
lucasliu2022 Dec 22, 2022
df98c59
remote console.log
lucasliu2022 Dec 22, 2022
7f91397
Merge pull request #21 from lucasliu2022/bugfix/flipper
Leechael Dec 22, 2022
47c9a20
package
lucasliu2022 Dec 29, 2022
314443c
tsup config
lucasliu2022 Jan 3, 2023
75428fd
update js sdk
lucasliu2022 Jan 3, 2023
2152a7f
compile browser and node
lucasliu2022 Jan 3, 2023
f60aa4f
Keep a dist folder
lucasliu2022 Jan 9, 2023
35af881
yarn lock remove @phala/sdk
lucasliu2022 Jan 9, 2023
0fde203
fixed llnt
lucasliu2022 Jan 9, 2023
8430612
packagejson files
lucasliu2022 Jan 9, 2023
df488e4
fix lint
lucasliu2022 Jan 9, 2023
e0c81e6
contractinfo and clusterInfo type
lucasliu2022 Jan 10, 2023
a017d19
prettier and remote interface
lucasliu2022 Jan 10, 2023
d1152a2
Try fix the duplicated publish issue.
Leechael Jan 12, 2023
c5a26d5
bump version
Leechael Jan 12, 2023
326ff59
Added @polkadot/api-contract into dependencies and bump version for t…
Leechael Jan 18, 2023
dce4134
fix: dependencies.
Leechael Jan 18, 2023
2284c58
Update description.
Leechael Jan 18, 2023
7c46605
bump version.
Leechael Jan 18, 2023
af8b539
Merge pull request #23 from Phala-Network/bugfix/add-polyfill
Leechael Jan 18, 2023
07e3da3
fix: now all wallet extension support WrapBytes.
Leechael Jan 30, 2023
a289710
bump version
Leechael Jan 30, 2023
e4b8742
bump version
Leechael Jan 30, 2023
c358f2c
Merge pull request #24 from Phala-Network/fix-all-wallet-extensions-s…
Leechael Jan 30, 2023
99545f6
fix: duplicated dependency, https://github.com/Phala-Network/js-sdk/i…
vabaly Feb 6, 2023
e5b6210
feat: update PhactoryAPI to latest version, https://github.com/Phala-…
vabaly Feb 6, 2023
6ce9d60
feat: export pruntime_rpc.PhactoryAPI as PhactoryAPI, https://github.…
vabaly Feb 6, 2023
6d378eb
Merge pull request #28 from Phala-Network/feat-update-proto
Leechael Feb 6, 2023
2ab65cf
Merge pull request #27 from Phala-Network/fix-duplicated-dependency
Leechael Feb 6, 2023
8dc687f
bump version
Leechael Feb 6, 2023
cf1debf
fix: sdk duplicated dependency, https://github.com/Phala-Network/js-s…
vabaly Feb 7, 2023
bdbd70c
fix: unify version of example
vabaly Feb 7, 2023
065eeb8
chore: update to 0.3.8-beta.0
vabaly Feb 7, 2023
1718a87
bump version
Leechael Feb 7, 2023
b6370ff
Merge branch 'main' into fix-duplicated-dependency
Leechael Feb 7, 2023
b995baf
Merge pull request #29 from Phala-Network/fix-duplicated-dependency
Leechael Feb 7, 2023
65aae2d
bump version
Leechael Feb 7, 2023
136ecdd
Archive statement.
Leechael Feb 7, 2023
c77e5dd
Added archive statement into the main README.md
Leechael Feb 7, 2023
d995ffb
chore: remove docs since it cause confusing when someone found out-of…
Leechael Nov 28, 2023
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
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16'
registry-url: 'https://registry.npmjs.org'
cache: 'yarn'
node-version: "16"
registry-url: "https://registry.npmjs.org"
cache: "yarn"
- run: yarn
- run: yarn test
- run: yarn lint
- run: yarn build
- uses: actions/upload-artifact@v2
with:
name: 'phala-js-sdk'
name: "phala-js-sdk"
path: |
packages/sdk/dist/
packages/sdk/package.json
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
name: publish
on:
release:
types: [created, edited]
types: [created]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16'
registry-url: 'https://registry.npmjs.org'
cache: 'yarn'
node-version: "16"
registry-url: "https://registry.npmjs.org"
cache: "yarn"
- run: yarn
- run: yarn workspace @phala/sdk build
- run: yarn workspace @phala/sdk publish
- run: yarn workspace @phala/sdk auto-publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ dist
tsconfig.tsbuildinfo
.npmrc
.eslintcache
browser
5 changes: 2 additions & 3 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"semi": false,
"singleQuote": true,
"bracketSpacing": false
"proseWrap": "never",
"quoteProps": "consistent"
}
7 changes: 6 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"eslint.workingDirectories": [{"pattern": "./packages/*/"}],
"editor.codeActionsOnSave": {
"source.addMissingImports": true,
"source.fixAll.eslint": true,
"source.sortImports": true
},
"eslint.workingDirectories": [{ "pattern": "./packages/*/" }],
"cSpell.ignoreWords": [
"polkadot",
"jotai",
Expand Down
546 changes: 546 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

Large diffs are not rendered by default.

785 changes: 0 additions & 785 deletions .yarn/releases/yarn-3.2.0.cjs

This file was deleted.

783 changes: 783 additions & 0 deletions .yarn/releases/yarn-3.2.3.cjs

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ nodeLinker: node-modules
plugins:
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"

yarnPath: .yarn/releases/yarn-3.2.0.cjs
yarnPath: .yarn/releases/yarn-3.2.3.cjs
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Phala JS SDK

This repository is an archive of Phat Conntract SDK before the move to [main repository](https://github.com/Phala-Network/phala-blockchain/tree/master/frontend/packages/sdk)

So please submit issues & pull requests there, this repository now is archive only.

> ⚠️ This package is under developing, and some features might change in the future.

JavaScript SDK for Phala.
Expand Down
4 changes: 2 additions & 2 deletions jest.config.cjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
preset: 'ts-jest',
}
preset: "ts-jest",
};
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
"test": "node --experimental-vm-modules node_modules/.bin/jest"
},
"devDependencies": {
"@types/jest": "^27.4.1",
"@types/jest": "^27.5.2",
"jest": "^27.5.1",
"prettier": "^2.5.1",
"ts-jest": "^27.1.3",
"ts-node": "^10.7.0",
"typescript": "^4.6.2"
"prettier": "^2.7.1",
"ts-jest": "^27.1.5",
"ts-node": "^10.9.1",
"typescript": "^4.8.4"
},
"packageManager": "yarn@3.2.0"
"packageManager": "yarn@3.2.3"
}
3 changes: 2 additions & 1 deletion packages/example/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
],
"parser": "@typescript-eslint/parser",
"rules": {
"no-console": "error"
"no-console": "error",
"@typescript-eslint/no-explicit-any": 0
}
}
10 changes: 5 additions & 5 deletions packages/example/atoms/account.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {atomWithStorage} from 'jotai/utils'
import type {InjectedAccountWithMeta} from '@polkadot/extension-inject/types'
import { atomWithStorage } from "jotai/utils";
import type { InjectedAccountWithMeta } from "@polkadot/extension-inject/types";

const accountAtom = atomWithStorage<InjectedAccountWithMeta | null>(
'atom:account',
"atom:account",
null
)
);

export default accountAtom
export default accountAtom;
82 changes: 41 additions & 41 deletions packages/example/components/AccountSelect.tsx
Original file line number Diff line number Diff line change
@@ -1,56 +1,56 @@
import {useState, useEffect} from 'react'
import type {InjectedAccountWithMeta} from '@polkadot/extension-inject/types'
import {useAtom} from 'jotai'
import {Select} from 'baseui/select'
import {LabelSmall, MonoParagraphXSmall} from 'baseui/typography'
import {Block} from 'baseui/block'
import {FormControl} from 'baseui/form-control'
import accountAtom from '../atoms/account'
import {enablePolkadotExtension} from '../lib/polkadotExtension'
import { useState, useEffect } from "react";
import type { InjectedAccountWithMeta } from "@polkadot/extension-inject/types";
import { useAtom } from "jotai";
import { Select } from "baseui/select";
import { LabelSmall, MonoParagraphXSmall } from "baseui/typography";
import { Block } from "baseui/block";
import { FormControl } from "baseui/form-control";
import accountAtom from "../atoms/account";
import { enablePolkadotExtension } from "../lib/polkadotExtension";

const trimAddress = (address: string) =>
`${address.slice(0, 6)}…${address.slice(-6)}`
`${address.slice(0, 6)}…${address.slice(-6)}`;

const AccountSelect = (): JSX.Element => {
const [error, setError] = useState(false)
const [account, setAccount] = useAtom(accountAtom)
const [options, setOptions] = useState<InjectedAccountWithMeta[]>([])
const [error, setError] = useState(false);
const [account, setAccount] = useAtom(accountAtom);
const [options, setOptions] = useState<InjectedAccountWithMeta[]>([]);

useEffect(() => {
let unsubscribe: () => void
let unsubscribe: () => void;

const subscribeAccounts = async () => {
await enablePolkadotExtension()
await enablePolkadotExtension();
const handleAccounts = (accounts: InjectedAccountWithMeta[]): void => {
setOptions(accounts)
}
const {web3Accounts, web3AccountsSubscribe} = await import(
'@polkadot/extension-dapp'
)
const accounts = await web3Accounts()
handleAccounts(accounts)
unsubscribe = await web3AccountsSubscribe(handleAccounts)
}
setOptions(accounts);
};
const { web3Accounts, web3AccountsSubscribe } = await import(
"@polkadot/extension-dapp"
);
const accounts = await web3Accounts();
handleAccounts(accounts);
unsubscribe = await web3AccountsSubscribe(handleAccounts);
};

try {
subscribeAccounts()
subscribeAccounts();
} catch (err) {
setError(true)
throw err
setError(true);
throw err;
}

return () => unsubscribe?.()
}, [])
return () => unsubscribe?.();
}, []);

useEffect(() => {
if (
account &&
options.length &&
!options.find(({address}) => address === account.address)
!options.find(({ address }) => address === account.address)
) {
setAccount(null)
setAccount(null);
}
}, [options, account, setAccount])
}, [options, account, setAccount]);

return (
<Block padding="0 20px" flex="0">
Expand All @@ -63,23 +63,23 @@ const AccountSelect = (): JSX.Element => {
},
},
}}
{...(error && {error: 'Polkadot{.js} extension error'})}
{...(error && { error: "Polkadot{.js} extension error" })}
>
<Select
size="compact"
placeholder="Select Account"
options={options}
getOptionLabel={({option}) =>
getOptionLabel={({ option }) =>
option && (
<>
<LabelSmall>{option.meta.name || 'Unknown'}</LabelSmall>
<LabelSmall>{option.meta.name || "Unknown"}</LabelSmall>
<MonoParagraphXSmall as="div">
{trimAddress(option.address)}
</MonoParagraphXSmall>
</>
)
}
getValueLabel={({option}) => (
getValueLabel={({ option }) => (
<>
<LabelSmall>{option.meta.name}</LabelSmall>
<MonoParagraphXSmall as="div">
Expand All @@ -90,14 +90,14 @@ const AccountSelect = (): JSX.Element => {
searchable={false}
valueKey="address"
value={account ? [account] : []}
onChange={({value}) =>
onChange={({ value }) =>
setAccount((value[0] as InjectedAccountWithMeta) || null)
}
overrides={{Root: {style: {width: '200px'}}}}
overrides={{ Root: { style: { width: "200px" } } }}
></Select>
</FormControl>
</Block>
)
}
);
};

export default AccountSelect
export default AccountSelect;
Loading