mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-11 19:50:36 +08:00
Remove registration fee
Since the DAO passed a proposal to remove the registration fee, we handle that in the UI. Signed-off-by: Alexis Sellier <self@cloudhead.io>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { navigate } from 'svelte-routing';
|
||||
import { formatAddress, formatBalance } from '@app/utils';
|
||||
import { formatAddress } from '@app/utils';
|
||||
import { session } from '@app/session';
|
||||
import type { Config } from '@app/config';
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
import Loading from '@app/Loading.svelte';
|
||||
import Message from '@app/Message.svelte';
|
||||
|
||||
import { registrar, registrationFee } from './registrar';
|
||||
import { registrar } from './registrar';
|
||||
|
||||
enum State {
|
||||
CheckingAvailability,
|
||||
@@ -26,7 +26,6 @@
|
||||
// We only support lower-case names.
|
||||
name = name.toLowerCase();
|
||||
|
||||
let fee: string;
|
||||
let state = State.CheckingAvailability;
|
||||
let error: string | null = null;
|
||||
$: registrationOwner = owner || ($session && $session.address);
|
||||
@@ -39,12 +38,7 @@
|
||||
|
||||
onMount(async () => {
|
||||
try {
|
||||
const [_fee, isAvailable] = await Promise.all([
|
||||
registrationFee(config),
|
||||
registrar(config).available(name),
|
||||
]);
|
||||
|
||||
fee = formatBalance(_fee);
|
||||
const isAvailable = await registrar(config).available(name);
|
||||
|
||||
if (isAvailable) {
|
||||
state = State.NameAvailable;
|
||||
@@ -76,11 +70,9 @@
|
||||
{#if state === State.NameAvailable}
|
||||
{#if registrationOwner}
|
||||
The name <strong>{name}</strong> is available for registration
|
||||
under account <strong>{formatAddress(registrationOwner)}</strong>
|
||||
for <strong>{fee} RAD</strong>.
|
||||
under account <strong>{formatAddress(registrationOwner)}</strong>.
|
||||
{:else}
|
||||
The name <strong>{name}</strong> is available
|
||||
for <strong>{fee} RAD</strong>.
|
||||
The name <strong>{name}</strong> is available.
|
||||
{/if}
|
||||
{:else if state === State.NameUnavailable}
|
||||
This name is <strong>not available</strong> for registration.
|
||||
|
||||
@@ -220,21 +220,32 @@ async function commit(
|
||||
const spender = config.registrar.address;
|
||||
const deadline = ethers.BigNumber.from(unixTime()).add(3600); // Expire one hour from now.
|
||||
const token = config.token;
|
||||
const signature = await permitSignature(config.signer, token, spender, fee, deadline);
|
||||
|
||||
state.set({ connection: State.SigningCommit });
|
||||
let tx = null;
|
||||
|
||||
const tx = await registrar(config)
|
||||
.connect(config.signer)
|
||||
.commitWithPermit(
|
||||
commitment,
|
||||
owner,
|
||||
fee,
|
||||
deadline,
|
||||
signature.v,
|
||||
signature.r,
|
||||
signature.s,
|
||||
{ gasLimit: 180000 });
|
||||
if (fee.isZero()) {
|
||||
state.set({ connection: State.SigningCommit });
|
||||
|
||||
tx = await registrar(config)
|
||||
.connect(config.signer)
|
||||
.commit(commitment, { gasLimit: 180000 });
|
||||
} else {
|
||||
const signature = await permitSignature(config.signer, token, spender, fee, deadline);
|
||||
|
||||
state.set({ connection: State.SigningCommit });
|
||||
|
||||
tx = await registrar(config)
|
||||
.connect(config.signer)
|
||||
.commitWithPermit(
|
||||
commitment,
|
||||
owner,
|
||||
fee,
|
||||
deadline,
|
||||
signature.v,
|
||||
signature.r,
|
||||
signature.s,
|
||||
{ gasLimit: 180000 });
|
||||
}
|
||||
|
||||
state.set({ connection: State.Committing });
|
||||
|
||||
|
||||
@@ -103,6 +103,7 @@
|
||||
"function radNode() view returns (bytes32)",
|
||||
"function minCommitmentAge() view returns (uint256)",
|
||||
"function registrationFeeRad() view returns (uint256)",
|
||||
"function commit(bytes32)",
|
||||
"function commitWithPermit(bytes32, address, uint256, uint256, uint8, bytes32, bytes32)",
|
||||
"function register(string, address, uint256)",
|
||||
"function valid(string) pure returns (bool)",
|
||||
|
||||
Reference in New Issue
Block a user