mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-10-18 19:30:27 +08:00
Make sure we have a signer in some cases
This commit is contained in:
+1
-1
@@ -107,7 +107,7 @@
|
||||
<div class="nav">
|
||||
<a use:link href="/registrations">Register</a>
|
||||
<a use:link href="/vesting/">Vesting</a>
|
||||
{#if config && config.network.name === 'ropsten'}
|
||||
{#if config && config.signer && config.network.name === 'ropsten'}
|
||||
<a use:link href="/orgs/">Orgs</a>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -32,6 +32,8 @@ export class Org {
|
||||
}
|
||||
|
||||
async setName(name: string, config: Config): Promise<TransactionResponse> {
|
||||
assert(config.signer);
|
||||
|
||||
const org = new ethers.Contract(
|
||||
this.address,
|
||||
orgAbi,
|
||||
@@ -78,6 +80,8 @@ export class Org {
|
||||
threshold: number,
|
||||
config: Config,
|
||||
): Promise<TransactionResponse> {
|
||||
assert(config.signer);
|
||||
|
||||
const orgFactory = new ethers.Contract(
|
||||
config.orgFactory.address,
|
||||
orgFactoryAbi,
|
||||
@@ -93,6 +97,8 @@ export class Org {
|
||||
owner: string,
|
||||
config: Config,
|
||||
): Promise<TransactionResponse> {
|
||||
assert(config.signer);
|
||||
|
||||
const orgFactory = new ethers.Contract(
|
||||
config.orgFactory.address,
|
||||
orgFactoryAbi,
|
||||
|
||||
@@ -84,6 +84,8 @@ export async function registrationFee(config: Config) {
|
||||
}
|
||||
|
||||
export async function registerName(name: string, owner: string, config: Config) {
|
||||
assert(config.signer);
|
||||
|
||||
if (! name) return;
|
||||
|
||||
let commitmentJson = window.localStorage.getItem('commitment');
|
||||
@@ -119,6 +121,8 @@ async function commitAndRegister(name: string, owner: string, config: Config) {
|
||||
}
|
||||
|
||||
async function commit(commitment: string, fee: BigNumber, minAge: number, config: Config) {
|
||||
assert(config.signer);
|
||||
|
||||
state.set(State.Committing);
|
||||
|
||||
const owner = config.signer;
|
||||
@@ -188,10 +192,10 @@ async function permitSignature(
|
||||
}
|
||||
|
||||
async function register(name: string, owner: string, salt: Uint8Array, config: Config) {
|
||||
assert(config.signer);
|
||||
state.set(State.Registering);
|
||||
|
||||
const signer = config.provider.getSigner();
|
||||
const tx = await registrar(config).connect(signer).register(
|
||||
const tx = await registrar(config).connect(config.signer).register(
|
||||
name, owner, ethers.BigNumber.from(salt), { gasLimit: 150000 }
|
||||
);
|
||||
console.log("Sent", tx);
|
||||
|
||||
@@ -2,6 +2,7 @@ import type { TransactionResponse } from '@ethersproject/providers';
|
||||
import type { EnsResolver } from '@ethersproject/providers';
|
||||
import { ethers } from 'ethers';
|
||||
import type { Config } from '@app/config';
|
||||
import { assert } from '@app/error';
|
||||
|
||||
const resolverAbi = [
|
||||
"function multicall(bytes[] calldata data) returns(bytes[] memory results)",
|
||||
@@ -12,6 +13,8 @@ const resolverAbi = [
|
||||
export type EnsRecord = { name: string, value: string };
|
||||
|
||||
export async function setRecords(name: string, records: EnsRecord[], resolver: EnsResolver, config: Config): Promise<TransactionResponse> {
|
||||
assert(config.signer);
|
||||
|
||||
const resolverContract = new ethers.Contract(resolver.address, resolverAbi, config.signer);
|
||||
const node = ethers.utils.namehash(`${name}.${config.registrar.domain}`);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user