Add registry gas price config
This commit is contained in:
parent
68080b61b3
commit
b6f4b4067f
@ -22,6 +22,7 @@ NEXT_PUBLIC_REGISTRY_RPC_ENDPOINT=https://laconicd-mainnet-1.laconic.com
|
|||||||
NEXT_PUBLIC_REGISTRY_GQL_ENDPOINT=https://laconicd-mainnet-1.laconic.com/graphql
|
NEXT_PUBLIC_REGISTRY_GQL_ENDPOINT=https://laconicd-mainnet-1.laconic.com/graphql
|
||||||
NEXT_PUBLIC_ALNT_COST_LRN=lrn://laconic/pricing/alnt
|
NEXT_PUBLIC_ALNT_COST_LRN=lrn://laconic/pricing/alnt
|
||||||
NEXT_PUBLIC_DEPLOYMENT_COST_LRN=lrn://laconic/pricing/webapp-deployment
|
NEXT_PUBLIC_DEPLOYMENT_COST_LRN=lrn://laconic/pricing/webapp-deployment
|
||||||
|
REGISTRY_GAS_PRICE=0.001
|
||||||
REGISTRY_BOND_ID=
|
REGISTRY_BOND_ID=
|
||||||
REGISTRY_AUTHORITY=
|
REGISTRY_AUTHORITY=
|
||||||
REGISTRY_USER_KEY=
|
REGISTRY_USER_KEY=
|
||||||
|
@ -190,6 +190,18 @@ export default function PaymentModal({
|
|||||||
</label>
|
</label>
|
||||||
<div className="space-y-3">
|
<div className="space-y-3">
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
|
{loadingPrice ? (
|
||||||
|
<div className="w-full p-3 rounded-md flex items-center" style={{
|
||||||
|
background: 'var(--muted-light)',
|
||||||
|
border: '1px solid var(--input-border)',
|
||||||
|
color: 'var(--muted)'
|
||||||
|
}}>
|
||||||
|
<svg className="animate-spin h-4 w-4 mr-2" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
|
||||||
|
<circle className="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="4"></circle>
|
||||||
|
<path className="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
value={`$${deploymentCost ? deploymentCost.toPrecision(2) : null}`}
|
value={`$${deploymentCost ? deploymentCost.toPrecision(2) : null}`}
|
||||||
@ -203,6 +215,7 @@ export default function PaymentModal({
|
|||||||
}}
|
}}
|
||||||
readOnly
|
readOnly
|
||||||
/>
|
/>
|
||||||
|
)}
|
||||||
<div className="absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none">
|
<div className="absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none">
|
||||||
<span className="text-sm font-medium" style={{ color: 'var(--muted)' }}>USD</span>
|
<span className="text-sm font-medium" style={{ color: 'var(--muted)' }}>USD</span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,17 +1,24 @@
|
|||||||
import { Registry } from '@cerc-io/registry-sdk';
|
import { DENOM as ALNT_DENOM, Registry } from '@cerc-io/registry-sdk';
|
||||||
|
|
||||||
import { RegistryConfig } from '../types';
|
import { RegistryConfig } from '../types';
|
||||||
|
import { GasPrice } from '@cosmjs/stargate';
|
||||||
|
|
||||||
let registryInstance: Registry | null = null;
|
let registryInstance: Registry | null = null;
|
||||||
|
|
||||||
|
|
||||||
export const getRegistry = (): Registry => {
|
export const getRegistry = (): Registry => {
|
||||||
if (!registryInstance) {
|
if (!registryInstance) {
|
||||||
const config = getClientRegistryConfig();
|
const config = getClientRegistryConfig();
|
||||||
|
const REGISTRY_GAS_PRICE = process.env.REGISTRY_GAS_PRICE;
|
||||||
|
const gasPrice = REGISTRY_GAS_PRICE ? GasPrice.fromString( REGISTRY_GAS_PRICE + ALNT_DENOM) : undefined;
|
||||||
|
|
||||||
registryInstance = new Registry(
|
registryInstance = new Registry(
|
||||||
config.gqlEndpoint,
|
config.gqlEndpoint,
|
||||||
config.rpcEndpoint,
|
config.rpcEndpoint,
|
||||||
{ chainId: config.chainId }
|
{
|
||||||
|
chainId: config.chainId,
|
||||||
|
gasPrice,
|
||||||
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return registryInstance;
|
return registryInstance;
|
||||||
|
Loading…
Reference in New Issue
Block a user