Skip to content

Commit

Permalink
add rpc urls
Browse files Browse the repository at this point in the history
  • Loading branch information
zlayine committed Jul 28, 2023
1 parent d342d0e commit f811af0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions resources/js/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ import { ApiPromise, WsProvider } from '@polkadot/api';
import { SignerPayloadJSON } from '@polkadot/types/types';
import { AccountInfoWithTripleRefCount } from '@polkadot/types/interfaces';

const RPC_URLS = {
canary: 'wss://rpc.matrix.canary.enjin.io',
efinity: 'wss://rpc.efinity.io',
};

const parseConfigHostname = (hostname: string): string => {
try {
const url = new URL(hostname);
Expand Down Expand Up @@ -311,7 +316,7 @@ export const useAppStore = defineStore('app', {
}
},
async signTransaction(transaction: any) {
const provider = new WsProvider('wss://rpc.efinity.io');
const provider = new WsProvider(RPC_URLS[this.config.network]);
const api = await ApiPromise.create({ provider });
const [genesisHash, runtime, account] = await Promise.all([
api.rpc.chain.getBlockHash(0),
Expand Down Expand Up @@ -351,7 +356,7 @@ export const useAppStore = defineStore('app', {
extrinsic.addSignature(this.account.address, signature, payloadToSign);

const submit = await api.rpc.author.submitExtrinsic(extrinsic.toHex());
console.log(submit);
console.log(submit.toHex());
},
async disconnectWallet() {
try {
Expand Down

0 comments on commit f811af0

Please sign in to comment.