Skip to content

Commit 4843273

Browse files
committed
Added chain WS URLs constants
1 parent bb4c9f4 commit 4843273

5 files changed

Lines changed: 27 additions & 24 deletions

File tree

.release-it.js

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,19 @@ const config = {
1010
publishArgs: ['--access=public'],
1111
},
1212
git: {
13-
"requireCleanWorkingDir": false,
13+
requireCleanWorkingDir: false,
1414
changelog: 'git log --pretty=format:"* %s (%h)" ${from}...${to}',
1515
commitMessage: 'chore: release v${version}',
1616
requireBranch: 'master',
17+
tagName: "v${version}",
1718
},
1819
"github": {
19-
"release": false,
20-
"releaseName": "Release ${version}",
21-
"releaseNotes": null,
22-
"autoGenerate": false,
23-
"preRelease": false,
24-
"draft": false,
25-
"tokenRef": "GITHUB_TOKEN",
26-
"assets": null,
27-
"host": null,
28-
"timeout": 0,
29-
"proxy": null,
30-
"skipChecks": false,
31-
"web": false
20+
release: true,
21+
releaseName: "Release ${version}",
22+
preRelease: true,
23+
autoGenerate: true,
24+
tokenRef: "GITHUB_TOKEN",
25+
assets: null,
3226
},
3327
}
3428

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ yarn add @unique-nft/api
1212
npm install @unique-nft/api
1313
```
1414

15-
Since this project rely on BigInt, there may be needed additional bundler settings.
15+
Since this project requires BigInt support there may be needed some additional bundler settings.
1616

1717
For Vite there may be useful to set esbuild target to es2020 at least, example of `vite.config.ts`:
1818

@@ -83,9 +83,9 @@ Transaction may be signed with keyring as well as with an account from the polka
8383
With keyring (available in both browser and Node.js):
8484

8585
```typescript
86-
import {Substrate, substrateTools} from '@unique-nft/api'
86+
import {Substrate, substrateTools, WS_RPC} from '@unique-nft/api'
8787

88-
const chain = new Substrate.Unique().connect('wss://...')
88+
const chain = new Substrate.Unique().connect(WS_RPC.quartz)
8989

9090
const keyring = substrateTools.signerTools.fromSeed('electric suit...')
9191

@@ -95,10 +95,10 @@ const result = await chain.transferCoins({...}).signAndSend(keyring)
9595
With the polkadot extension (available in browser only):
9696

9797
```typescript
98-
import {Substrate, polkadotExtensionTools} from '@unique-nft/api'
98+
import {Substrate, polkadotExtensionTools, WS_RPC} from '@unique-nft/api'
9999

100-
const quartz = new Substrate.Unique().connect('wss://quartz.unique.network')
101-
const kusama = new Substrate.Common().connect('wss://kusama-rpc.polkadot.io')
100+
const quartz = new Substrate.Unique().connect(WS_RPC.quartz)
101+
const kusama = new Substrate.Common().connect(WS_RPC.kusama)
102102

103103
const accounts = await polkadotExtensionTools.getAllAccounts()
104104
const account = accounts.find(account => account.address === '5...')
@@ -116,15 +116,15 @@ Substrate class provide methods which take transaction parameters and return Tra
116116
Example:
117117

118118
```typescript
119-
const result = await chain
119+
const result = await quartz
120120
.transferCoins({toAddress: '5...', amountInWei: 1n})
121121
.signAndSend(keyringOrAccount)
122122
```
123123

124124
More verbose example:
125125

126126
```typescript
127-
const tx = chain.transferCoins({toAddress: '5...', amountInWei: 1n})
127+
const tx = quartz.transferCoins({toAddress: '5...', amountInWei: 1n})
128128
await tx.sign(keyringOrAccount)
129129
console.log(tx.getRawTx().toJSON())
130130
const result = await tx.send()

src/constants.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,11 @@
11
export const NESTING_PREFIX = '0xf8238ccfff8ed887463fd5e0'
22
export const COLLECTION_ADDRESS_PREFIX = '0x17c4e6453cc49aaaaeaca894e6d9683e'
3+
4+
export const WS_RPC = {
5+
unique: 'wss://eu-ws.unique.network',
6+
quartz: 'wss://quartz.unique.network',
7+
uniqueRC: 'wss://ws-rc.unique.network',
8+
opal: 'wss://opal.unique.network',
9+
polkadot: 'wss://rpc.polkadot.io',
10+
kusama: 'wss://quartz.api.onfinality.io/public-ws',
11+
}

src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ export const init = libs.init
77
export * from './types'
88

99
export * as constants from './constants'
10-
export {utils} from './utils'
10+
export {WS_RPC} from './constants'
1111

12+
export {utils} from './utils'
1213

1314
export * as ethereum from './ethereum'
1415
import * as substrateTools from './substrate'

src/substrate/SubstrateCommon.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ export class SubstrateCommon {
4040
return this._coin
4141
}
4242

43-
4443
async connect(wsEndpoint: string, options?: ConnectToSubstrateOptions) {
4544
try {
4645
new URL(wsEndpoint) // just to test it in a quick way

0 commit comments

Comments
 (0)