mirror of
https://github.com/onsonr/sonr.git
synced 2025-03-10 13:07:09 +00:00
refactor: remove obsolete interchain test dependencies
This commit is contained in:
parent
72f42afb81
commit
737565344d
293
devbox.lock
293
devbox.lock
@ -1,293 +0,0 @@
|
|||||||
{
|
|
||||||
"lockfile_version": "1",
|
|
||||||
"packages": {
|
|
||||||
"bun@latest": {
|
|
||||||
"last_modified": "2024-11-26T10:33:56Z",
|
|
||||||
"resolved": "github:NixOS/nixpkgs/af51545ec9a44eadf3fe3547610a5cdd882bc34e#bun",
|
|
||||||
"source": "devbox-search",
|
|
||||||
"version": "1.1.34",
|
|
||||||
"systems": {
|
|
||||||
"aarch64-darwin": {
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "out",
|
|
||||||
"path": "/nix/store/0hxh6hmzkpg56l11vsnyb287jynhf5f4-bun-1.1.34",
|
|
||||||
"default": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"store_path": "/nix/store/0hxh6hmzkpg56l11vsnyb287jynhf5f4-bun-1.1.34"
|
|
||||||
},
|
|
||||||
"aarch64-linux": {
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "out",
|
|
||||||
"path": "/nix/store/mc6bikx8a0rqm1xk040w2q861syxpr8d-bun-1.1.34",
|
|
||||||
"default": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"store_path": "/nix/store/mc6bikx8a0rqm1xk040w2q861syxpr8d-bun-1.1.34"
|
|
||||||
},
|
|
||||||
"x86_64-darwin": {
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "out",
|
|
||||||
"path": "/nix/store/fn9h6y3v8il2yax5pm965lacxzj8pq9q-bun-1.1.34",
|
|
||||||
"default": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"store_path": "/nix/store/fn9h6y3v8il2yax5pm965lacxzj8pq9q-bun-1.1.34"
|
|
||||||
},
|
|
||||||
"x86_64-linux": {
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "out",
|
|
||||||
"path": "/nix/store/mzk71frmsppga4i7sz7ca3r9wxv8slx9-bun-1.1.34",
|
|
||||||
"default": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"store_path": "/nix/store/mzk71frmsppga4i7sz7ca3r9wxv8slx9-bun-1.1.34"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"go@latest": {
|
|
||||||
"last_modified": "2024-11-28T07:51:56Z",
|
|
||||||
"resolved": "github:NixOS/nixpkgs/226216574ada4c3ecefcbbec41f39ce4655f78ef#go",
|
|
||||||
"source": "devbox-search",
|
|
||||||
"version": "1.23.3",
|
|
||||||
"systems": {
|
|
||||||
"aarch64-darwin": {
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "out",
|
|
||||||
"path": "/nix/store/qrj2wp6vzfpjfrrlcmr22818zg83fb73-go-1.23.3",
|
|
||||||
"default": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"store_path": "/nix/store/qrj2wp6vzfpjfrrlcmr22818zg83fb73-go-1.23.3"
|
|
||||||
},
|
|
||||||
"aarch64-linux": {
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "out",
|
|
||||||
"path": "/nix/store/dm66qyl19skrwcmk4rb9xcs64xc1d071-go-1.23.3",
|
|
||||||
"default": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"store_path": "/nix/store/dm66qyl19skrwcmk4rb9xcs64xc1d071-go-1.23.3"
|
|
||||||
},
|
|
||||||
"x86_64-darwin": {
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "out",
|
|
||||||
"path": "/nix/store/vkjn6njpz4gy5ma763vh8hh93bgjwycr-go-1.23.3",
|
|
||||||
"default": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"store_path": "/nix/store/vkjn6njpz4gy5ma763vh8hh93bgjwycr-go-1.23.3"
|
|
||||||
},
|
|
||||||
"x86_64-linux": {
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "out",
|
|
||||||
"path": "/nix/store/bavnchxi7v6xs077jxv7fl5rrqc3y87w-go-1.23.3",
|
|
||||||
"default": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"store_path": "/nix/store/bavnchxi7v6xs077jxv7fl5rrqc3y87w-go-1.23.3"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"process-compose@latest": {
|
|
||||||
"last_modified": "2024-11-28T07:51:56Z",
|
|
||||||
"resolved": "github:NixOS/nixpkgs/226216574ada4c3ecefcbbec41f39ce4655f78ef#process-compose",
|
|
||||||
"source": "devbox-search",
|
|
||||||
"version": "1.40.1",
|
|
||||||
"systems": {
|
|
||||||
"aarch64-darwin": {
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "out",
|
|
||||||
"path": "/nix/store/ndvh1v1881a3pwxyw1g38mhp5xzrpz16-process-compose-1.40.1",
|
|
||||||
"default": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"store_path": "/nix/store/ndvh1v1881a3pwxyw1g38mhp5xzrpz16-process-compose-1.40.1"
|
|
||||||
},
|
|
||||||
"aarch64-linux": {
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "out",
|
|
||||||
"path": "/nix/store/7jw864z6wlzcirsz8fgaj2bw0f22izch-process-compose-1.40.1",
|
|
||||||
"default": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"store_path": "/nix/store/7jw864z6wlzcirsz8fgaj2bw0f22izch-process-compose-1.40.1"
|
|
||||||
},
|
|
||||||
"x86_64-darwin": {
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "out",
|
|
||||||
"path": "/nix/store/qz9gb3briakkvylq3markxd1s7plaw47-process-compose-1.40.1",
|
|
||||||
"default": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"store_path": "/nix/store/qz9gb3briakkvylq3markxd1s7plaw47-process-compose-1.40.1"
|
|
||||||
},
|
|
||||||
"x86_64-linux": {
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "out",
|
|
||||||
"path": "/nix/store/0vq97wmm879440n8plsk1yjc1g28ai85-process-compose-1.40.1",
|
|
||||||
"default": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"store_path": "/nix/store/0vq97wmm879440n8plsk1yjc1g28ai85-process-compose-1.40.1"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"skate@latest": {
|
|
||||||
"last_modified": "2024-11-28T07:51:56Z",
|
|
||||||
"resolved": "github:NixOS/nixpkgs/226216574ada4c3ecefcbbec41f39ce4655f78ef#skate",
|
|
||||||
"source": "devbox-search",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"systems": {
|
|
||||||
"aarch64-darwin": {
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "out",
|
|
||||||
"path": "/nix/store/q6yhpyfbqiabyic6ymx5rp2db62bnbvr-skate-1.0.0",
|
|
||||||
"default": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"store_path": "/nix/store/q6yhpyfbqiabyic6ymx5rp2db62bnbvr-skate-1.0.0"
|
|
||||||
},
|
|
||||||
"aarch64-linux": {
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "out",
|
|
||||||
"path": "/nix/store/q55dbgvc4xwvr2g02dks6j2j699qni2k-skate-1.0.0",
|
|
||||||
"default": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"store_path": "/nix/store/q55dbgvc4xwvr2g02dks6j2j699qni2k-skate-1.0.0"
|
|
||||||
},
|
|
||||||
"x86_64-darwin": {
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "out",
|
|
||||||
"path": "/nix/store/s1hy525y8ciya3nrns9kryy3jlcw8igv-skate-1.0.0",
|
|
||||||
"default": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"store_path": "/nix/store/s1hy525y8ciya3nrns9kryy3jlcw8igv-skate-1.0.0"
|
|
||||||
},
|
|
||||||
"x86_64-linux": {
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "out",
|
|
||||||
"path": "/nix/store/8s03iazymz77nv6pjxpz7wair0m646wv-skate-1.0.0",
|
|
||||||
"default": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"store_path": "/nix/store/8s03iazymz77nv6pjxpz7wair0m646wv-skate-1.0.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"templ@latest": {
|
|
||||||
"last_modified": "2024-11-28T07:51:56Z",
|
|
||||||
"resolved": "github:NixOS/nixpkgs/226216574ada4c3ecefcbbec41f39ce4655f78ef#templ",
|
|
||||||
"source": "devbox-search",
|
|
||||||
"version": "0.2.793",
|
|
||||||
"systems": {
|
|
||||||
"aarch64-darwin": {
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "out",
|
|
||||||
"path": "/nix/store/ivargvf76g71k5gk3iz4al52rsy28w38-templ-0.2.793",
|
|
||||||
"default": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"store_path": "/nix/store/ivargvf76g71k5gk3iz4al52rsy28w38-templ-0.2.793"
|
|
||||||
},
|
|
||||||
"aarch64-linux": {
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "out",
|
|
||||||
"path": "/nix/store/03654iddn006yx5j1lqq496hax60v8p5-templ-0.2.793",
|
|
||||||
"default": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"store_path": "/nix/store/03654iddn006yx5j1lqq496hax60v8p5-templ-0.2.793"
|
|
||||||
},
|
|
||||||
"x86_64-darwin": {
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "out",
|
|
||||||
"path": "/nix/store/blvd5wbd1ix6m745s4zx3b84kwzprshq-templ-0.2.793",
|
|
||||||
"default": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"store_path": "/nix/store/blvd5wbd1ix6m745s4zx3b84kwzprshq-templ-0.2.793"
|
|
||||||
},
|
|
||||||
"x86_64-linux": {
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "out",
|
|
||||||
"path": "/nix/store/sn5h79d36r86i6a8rm1k52c2ij1s32kx-templ-0.2.793",
|
|
||||||
"default": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"store_path": "/nix/store/sn5h79d36r86i6a8rm1k52c2ij1s32kx-templ-0.2.793"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"tigerbeetle@latest": {
|
|
||||||
"last_modified": "2024-11-30T03:39:21Z",
|
|
||||||
"resolved": "github:NixOS/nixpkgs/4703b8d2c708e13a8cab03d865f90973536dcdf5#tigerbeetle",
|
|
||||||
"source": "devbox-search",
|
|
||||||
"version": "0.16.14",
|
|
||||||
"systems": {
|
|
||||||
"aarch64-darwin": {
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "out",
|
|
||||||
"path": "/nix/store/jgcj3ci7708zsgirgjl4cdnaq7x59fm4-tigerbeetle-0.16.14",
|
|
||||||
"default": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"store_path": "/nix/store/jgcj3ci7708zsgirgjl4cdnaq7x59fm4-tigerbeetle-0.16.14"
|
|
||||||
},
|
|
||||||
"aarch64-linux": {
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "out",
|
|
||||||
"path": "/nix/store/b4zqvr0zanwvdz8c7fs6w1h51fh6pa1j-tigerbeetle-0.16.14",
|
|
||||||
"default": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"store_path": "/nix/store/b4zqvr0zanwvdz8c7fs6w1h51fh6pa1j-tigerbeetle-0.16.14"
|
|
||||||
},
|
|
||||||
"x86_64-darwin": {
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "out",
|
|
||||||
"path": "/nix/store/nqi4rb34bdcra0sx59dnipdp347smndx-tigerbeetle-0.16.14",
|
|
||||||
"default": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"store_path": "/nix/store/nqi4rb34bdcra0sx59dnipdp347smndx-tigerbeetle-0.16.14"
|
|
||||||
},
|
|
||||||
"x86_64-linux": {
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "out",
|
|
||||||
"path": "/nix/store/224jvdiazicsmm1r5dpykk912rzlyhgr-tigerbeetle-0.16.14",
|
|
||||||
"default": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"store_path": "/nix/store/224jvdiazicsmm1r5dpykk912rzlyhgr-tigerbeetle-0.16.14"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,47 +0,0 @@
|
|||||||
package e2e
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
"github.com/strangelove-ventures/interchaintest/v8"
|
|
||||||
"github.com/strangelove-ventures/interchaintest/v8/chain/cosmos"
|
|
||||||
"github.com/stretchr/testify/require"
|
|
||||||
"go.uber.org/zap/zaptest"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestBasicChain(t *testing.T) {
|
|
||||||
cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{
|
|
||||||
&DefaultChainSpec,
|
|
||||||
})
|
|
||||||
|
|
||||||
chains, err := cf.Chains(t.Name())
|
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
chain := chains[0].(*cosmos.CosmosChain)
|
|
||||||
|
|
||||||
ic := interchaintest.NewInterchain().
|
|
||||||
AddChain(chain)
|
|
||||||
|
|
||||||
ctx := context.Background()
|
|
||||||
client, network := interchaintest.DockerSetup(t)
|
|
||||||
|
|
||||||
require.NoError(t, ic.Build(ctx, nil, interchaintest.InterchainBuildOptions{
|
|
||||||
TestName: t.Name(),
|
|
||||||
Client: client,
|
|
||||||
NetworkID: network,
|
|
||||||
SkipPathCreation: true,
|
|
||||||
}))
|
|
||||||
t.Cleanup(func() {
|
|
||||||
_ = ic.Close()
|
|
||||||
})
|
|
||||||
|
|
||||||
// faucet funds to the user
|
|
||||||
users := interchaintest.GetAndFundTestUsers(t, ctx, "default", GenesisFundsAmount, chain)
|
|
||||||
user := users[0]
|
|
||||||
|
|
||||||
// balance check
|
|
||||||
balance, err := chain.GetBalance(ctx, user.FormattedAddress(), Denom)
|
|
||||||
require.NoError(t, err)
|
|
||||||
require.True(t, balance.Equal(GenesisFundsAmount), "user balance should be equal to genesis funds")
|
|
||||||
}
|
|
@ -1,280 +0,0 @@
|
|||||||
module github.com/di-dao/core/interchaintest
|
|
||||||
|
|
||||||
go 1.22
|
|
||||||
|
|
||||||
toolchain go1.22.7
|
|
||||||
|
|
||||||
replace (
|
|
||||||
// not tagged properly (SDK v51)
|
|
||||||
cosmossdk.io/core => cosmossdk.io/core v0.11.0
|
|
||||||
github.com/ChainSafe/go-schnorrkel => github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d
|
|
||||||
github.com/ChainSafe/go-schnorrkel/1 => github.com/ChainSafe/go-schnorrkel v1.0.0
|
|
||||||
github.com/btcsuite/btcd => github.com/btcsuite/btcd v0.22.2 //indirect
|
|
||||||
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
|
|
||||||
// breaks SDK app.toml parsing for client configs.
|
|
||||||
github.com/spf13/viper => github.com/spf13/viper v1.17.0
|
|
||||||
|
|
||||||
// If using custom internal modules, replace your app here with the parent application
|
|
||||||
// github.com/di-dao/core => ../.
|
|
||||||
|
|
||||||
github.com/vedhavyas/go-subkey => github.com/strangelove-ventures/go-subkey v1.0.7
|
|
||||||
)
|
|
||||||
|
|
||||||
require (
|
|
||||||
cosmossdk.io/math v1.3.0
|
|
||||||
github.com/cosmos/cosmos-sdk v0.50.5
|
|
||||||
github.com/cosmos/ibc-go/v8 v8.2.0
|
|
||||||
github.com/strangelove-ventures/globalfee v0.50.0
|
|
||||||
github.com/strangelove-ventures/interchaintest/v8 v8.1.0
|
|
||||||
github.com/strangelove-ventures/poa v0.50.0
|
|
||||||
github.com/strangelove-ventures/tokenfactory v0.50.0
|
|
||||||
github.com/stretchr/testify v1.9.0
|
|
||||||
go.uber.org/zap v1.27.0
|
|
||||||
)
|
|
||||||
|
|
||||||
require (
|
|
||||||
cloud.google.com/go v0.112.0 // indirect
|
|
||||||
cloud.google.com/go/compute/metadata v0.5.0 // indirect
|
|
||||||
cloud.google.com/go/iam v1.1.6 // indirect
|
|
||||||
cloud.google.com/go/storage v1.37.0 // indirect
|
|
||||||
cosmossdk.io/api v0.7.3 // indirect
|
|
||||||
cosmossdk.io/collections v0.4.0 // indirect
|
|
||||||
cosmossdk.io/core v0.12.0 // indirect
|
|
||||||
cosmossdk.io/depinject v1.0.0-alpha.4 // indirect
|
|
||||||
cosmossdk.io/errors v1.0.1 // indirect
|
|
||||||
cosmossdk.io/log v1.3.1 // indirect
|
|
||||||
cosmossdk.io/store v1.0.2 // indirect
|
|
||||||
cosmossdk.io/x/feegrant v0.1.0 // indirect
|
|
||||||
cosmossdk.io/x/tx v0.13.1 // indirect
|
|
||||||
cosmossdk.io/x/upgrade v0.1.1 // indirect
|
|
||||||
filippo.io/edwards25519 v1.0.0 // indirect
|
|
||||||
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
|
|
||||||
github.com/99designs/keyring v1.2.2 // indirect
|
|
||||||
github.com/BurntSushi/toml v1.4.0 // indirect
|
|
||||||
github.com/ChainSafe/go-schnorrkel v1.1.0 // indirect
|
|
||||||
github.com/ChainSafe/go-schnorrkel/1 v0.0.0-00010101000000-000000000000 // indirect
|
|
||||||
github.com/ComposableFi/go-subkey/v2 v2.0.0-tm03420 // indirect
|
|
||||||
github.com/DataDog/datadog-go v3.2.0+incompatible // indirect
|
|
||||||
github.com/DataDog/zstd v1.5.5 // indirect
|
|
||||||
github.com/FactomProject/basen v0.0.0-20150613233007-fe3947df716e // indirect
|
|
||||||
github.com/FactomProject/btcutilecc v0.0.0-20130527213604-d3a63a5752ec // indirect
|
|
||||||
github.com/Microsoft/go-winio v0.6.1 // indirect
|
|
||||||
github.com/StirlingMarketingGroup/go-namecase v1.0.0 // indirect
|
|
||||||
github.com/avast/retry-go/v4 v4.5.1 // indirect
|
|
||||||
github.com/aws/aws-sdk-go v1.46.6 // indirect
|
|
||||||
github.com/beorn7/perks v1.0.1 // indirect
|
|
||||||
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
|
|
||||||
github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect
|
|
||||||
github.com/bits-and-blooms/bitset v1.10.0 // indirect
|
|
||||||
github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect
|
|
||||||
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
|
|
||||||
github.com/cespare/xxhash v1.1.0 // indirect
|
|
||||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
|
||||||
github.com/chzyer/readline v1.5.1 // indirect
|
|
||||||
github.com/cockroachdb/errors v1.11.3 // indirect
|
|
||||||
github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce // indirect
|
|
||||||
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
|
|
||||||
github.com/cockroachdb/pebble v1.1.1 // indirect
|
|
||||||
github.com/cockroachdb/redact v1.1.5 // indirect
|
|
||||||
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
|
|
||||||
github.com/cometbft/cometbft v0.38.12 // indirect
|
|
||||||
github.com/cometbft/cometbft-db v0.11.0 // indirect
|
|
||||||
github.com/containerd/log v0.1.0 // indirect
|
|
||||||
github.com/cosmos/btcutil v1.0.5 // indirect
|
|
||||||
github.com/cosmos/cosmos-db v1.0.2 // indirect
|
|
||||||
github.com/cosmos/cosmos-proto v1.0.0-beta.4 // indirect
|
|
||||||
github.com/cosmos/go-bip39 v1.0.0 // indirect
|
|
||||||
github.com/cosmos/gogogateway v1.2.0 // indirect
|
|
||||||
github.com/cosmos/gogoproto v1.7.0 // indirect
|
|
||||||
github.com/cosmos/iavl v1.0.1 // indirect
|
|
||||||
github.com/cosmos/ibc-go/modules/capability v1.0.0 // indirect
|
|
||||||
github.com/cosmos/ics23/go v0.10.0 // indirect
|
|
||||||
github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect
|
|
||||||
github.com/danieljoos/wincred v1.2.0 // indirect
|
|
||||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
|
|
||||||
github.com/deckarep/golang-set v1.8.0 // indirect
|
|
||||||
github.com/decred/base58 v1.0.5 // indirect
|
|
||||||
github.com/decred/dcrd/crypto/blake256 v1.0.1 // indirect
|
|
||||||
github.com/decred/dcrd/dcrec/secp256k1/v2 v2.0.1 // indirect
|
|
||||||
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
|
|
||||||
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect
|
|
||||||
github.com/dgraph-io/badger/v2 v2.2007.4 // indirect
|
|
||||||
github.com/dgraph-io/ristretto v0.1.1 // indirect
|
|
||||||
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect
|
|
||||||
github.com/distribution/reference v0.5.0 // indirect
|
|
||||||
github.com/docker/docker v25.0.6+incompatible // indirect
|
|
||||||
github.com/docker/go-connections v0.5.0 // indirect
|
|
||||||
github.com/docker/go-units v0.5.0 // indirect
|
|
||||||
github.com/dustin/go-humanize v1.0.1 // indirect
|
|
||||||
github.com/dvsekhvalnov/jose2go v1.6.0 // indirect
|
|
||||||
github.com/emicklei/dot v1.6.1 // indirect
|
|
||||||
github.com/ethereum/go-ethereum v1.14.0 // indirect
|
|
||||||
github.com/fatih/color v1.15.0 // indirect
|
|
||||||
github.com/felixge/httpsnoop v1.0.4 // indirect
|
|
||||||
github.com/fsnotify/fsnotify v1.7.0 // indirect
|
|
||||||
github.com/getsentry/sentry-go v0.27.0 // indirect
|
|
||||||
github.com/go-kit/kit v0.13.0 // indirect
|
|
||||||
github.com/go-kit/log v0.2.1 // indirect
|
|
||||||
github.com/go-logfmt/logfmt v0.6.0 // indirect
|
|
||||||
github.com/go-logr/logr v1.4.2 // indirect
|
|
||||||
github.com/go-logr/stdr v1.2.2 // indirect
|
|
||||||
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect
|
|
||||||
github.com/gogo/googleapis v1.4.1 // indirect
|
|
||||||
github.com/gogo/protobuf v1.3.3 // indirect
|
|
||||||
github.com/golang/glog v1.2.2 // indirect
|
|
||||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
|
||||||
github.com/golang/mock v1.6.0 // indirect
|
|
||||||
github.com/golang/protobuf v1.5.4 // indirect
|
|
||||||
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
|
|
||||||
github.com/google/btree v1.1.2 // indirect
|
|
||||||
github.com/google/go-cmp v0.6.0 // indirect
|
|
||||||
github.com/google/orderedcode v0.0.1 // indirect
|
|
||||||
github.com/google/s2a-go v0.1.7 // indirect
|
|
||||||
github.com/google/uuid v1.6.0 // indirect
|
|
||||||
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
|
|
||||||
github.com/googleapis/gax-go/v2 v2.12.0 // indirect
|
|
||||||
github.com/gorilla/handlers v1.5.2 // indirect
|
|
||||||
github.com/gorilla/mux v1.8.1 // indirect
|
|
||||||
github.com/gorilla/websocket v1.5.3 // indirect
|
|
||||||
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
|
|
||||||
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
|
|
||||||
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
|
|
||||||
github.com/gtank/merlin v0.1.1 // indirect
|
|
||||||
github.com/gtank/ristretto255 v0.1.2 // indirect
|
|
||||||
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
|
|
||||||
github.com/hashicorp/go-getter v1.7.5 // indirect
|
|
||||||
github.com/hashicorp/go-hclog v1.5.0 // indirect
|
|
||||||
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
|
|
||||||
github.com/hashicorp/go-metrics v0.5.2 // indirect
|
|
||||||
github.com/hashicorp/go-plugin v1.5.2 // indirect
|
|
||||||
github.com/hashicorp/go-safetemp v1.0.0 // indirect
|
|
||||||
github.com/hashicorp/go-version v1.6.0 // indirect
|
|
||||||
github.com/hashicorp/golang-lru v1.0.2 // indirect
|
|
||||||
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
|
|
||||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
|
||||||
github.com/hashicorp/yamux v0.1.1 // indirect
|
|
||||||
github.com/hdevalence/ed25519consensus v0.1.0 // indirect
|
|
||||||
github.com/holiman/uint256 v1.2.4 // indirect
|
|
||||||
github.com/huandu/skiplist v1.2.0 // indirect
|
|
||||||
github.com/iancoleman/strcase v0.3.0 // indirect
|
|
||||||
github.com/icza/dyno v0.0.0-20230330125955-09f820a8d9c0 // indirect
|
|
||||||
github.com/improbable-eng/grpc-web v0.15.0 // indirect
|
|
||||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
|
||||||
github.com/ipfs/go-cid v0.4.1 // indirect
|
|
||||||
github.com/jmespath/go-jmespath v0.4.0 // indirect
|
|
||||||
github.com/jmhodges/levigo v1.0.0 // indirect
|
|
||||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
|
|
||||||
github.com/klauspost/compress v1.17.9 // indirect
|
|
||||||
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
|
|
||||||
github.com/kr/pretty v0.3.1 // indirect
|
|
||||||
github.com/kr/text v0.2.0 // indirect
|
|
||||||
github.com/lib/pq v1.10.9 // indirect
|
|
||||||
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
|
|
||||||
github.com/libp2p/go-libp2p v0.33.2 // indirect
|
|
||||||
github.com/linxGnu/grocksdb v1.8.12 // indirect
|
|
||||||
github.com/magiconair/properties v1.8.7 // indirect
|
|
||||||
github.com/manifoldco/promptui v0.9.0 // indirect
|
|
||||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
|
||||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
|
||||||
github.com/mimoo/StrobeGo v0.0.0-20220103164710-9a04d6ca976b // indirect
|
|
||||||
github.com/minio/highwayhash v1.0.2 // indirect
|
|
||||||
github.com/minio/sha256-simd v1.0.1 // indirect
|
|
||||||
github.com/misko9/go-substrate-rpc-client/v4 v4.0.0-20230913220906-b988ea7da0c2 // indirect
|
|
||||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
|
||||||
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
|
|
||||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
|
||||||
github.com/mr-tron/base58 v1.2.0 // indirect
|
|
||||||
github.com/mtibben/percent v0.2.1 // indirect
|
|
||||||
github.com/multiformats/go-base32 v0.1.0 // indirect
|
|
||||||
github.com/multiformats/go-base36 v0.2.0 // indirect
|
|
||||||
github.com/multiformats/go-multiaddr v0.12.3 // indirect
|
|
||||||
github.com/multiformats/go-multibase v0.2.0 // indirect
|
|
||||||
github.com/multiformats/go-multicodec v0.9.0 // indirect
|
|
||||||
github.com/multiformats/go-multihash v0.2.3 // indirect
|
|
||||||
github.com/multiformats/go-varint v0.0.7 // indirect
|
|
||||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
|
||||||
github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect
|
|
||||||
github.com/oklog/run v1.1.0 // indirect
|
|
||||||
github.com/onsi/gomega v1.30.0 // indirect
|
|
||||||
github.com/opencontainers/go-digest v1.0.0 // indirect
|
|
||||||
github.com/opencontainers/image-spec v1.1.0-rc5 // indirect
|
|
||||||
github.com/pelletier/go-toml v1.9.5 // indirect
|
|
||||||
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
|
|
||||||
github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc // indirect
|
|
||||||
github.com/pierrec/xxHash v0.1.5 // indirect
|
|
||||||
github.com/pkg/errors v0.9.1 // indirect
|
|
||||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
|
||||||
github.com/prometheus/client_golang v1.20.1 // indirect
|
|
||||||
github.com/prometheus/client_model v0.6.1 // indirect
|
|
||||||
github.com/prometheus/common v0.55.0 // indirect
|
|
||||||
github.com/prometheus/procfs v0.15.1 // indirect
|
|
||||||
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
|
|
||||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
|
|
||||||
github.com/rogpeppe/go-internal v1.12.0 // indirect
|
|
||||||
github.com/rs/cors v1.11.1 // indirect
|
|
||||||
github.com/rs/zerolog v1.32.0 // indirect
|
|
||||||
github.com/sagikazarmark/locafero v0.4.0 // indirect
|
|
||||||
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
|
|
||||||
github.com/sasha-s/go-deadlock v0.3.1 // indirect
|
|
||||||
github.com/sourcegraph/conc v0.3.0 // indirect
|
|
||||||
github.com/spaolacci/murmur3 v1.1.0 // indirect
|
|
||||||
github.com/spf13/afero v1.11.0 // indirect
|
|
||||||
github.com/spf13/cast v1.6.0 // indirect
|
|
||||||
github.com/spf13/cobra v1.8.1 // indirect
|
|
||||||
github.com/spf13/pflag v1.0.5 // indirect
|
|
||||||
github.com/spf13/viper v1.19.0 // indirect
|
|
||||||
github.com/subosito/gotenv v1.6.0 // indirect
|
|
||||||
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect
|
|
||||||
github.com/tendermint/go-amino v0.16.0 // indirect
|
|
||||||
github.com/tidwall/btree v1.7.0 // indirect
|
|
||||||
github.com/tyler-smith/go-bip32 v1.0.0 // indirect
|
|
||||||
github.com/tyler-smith/go-bip39 v1.1.0 // indirect
|
|
||||||
github.com/ulikunitz/xz v0.5.11 // indirect
|
|
||||||
github.com/zondax/hid v0.9.2 // indirect
|
|
||||||
github.com/zondax/ledger-go v0.14.3 // indirect
|
|
||||||
go.etcd.io/bbolt v1.3.10 // indirect
|
|
||||||
go.opencensus.io v0.24.0 // indirect
|
|
||||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0 // indirect
|
|
||||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 // indirect
|
|
||||||
go.opentelemetry.io/otel v1.31.0 // indirect
|
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.31.0 // indirect
|
|
||||||
go.opentelemetry.io/otel/metric v1.31.0 // indirect
|
|
||||||
go.opentelemetry.io/otel/sdk v1.31.0 // indirect
|
|
||||||
go.opentelemetry.io/otel/trace v1.31.0 // indirect
|
|
||||||
go.uber.org/multierr v1.11.0 // indirect
|
|
||||||
golang.org/x/crypto v0.28.0 // indirect
|
|
||||||
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect
|
|
||||||
golang.org/x/mod v0.17.0 // indirect
|
|
||||||
golang.org/x/net v0.30.0 // indirect
|
|
||||||
golang.org/x/oauth2 v0.22.0 // indirect
|
|
||||||
golang.org/x/sync v0.8.0 // indirect
|
|
||||||
golang.org/x/sys v0.26.0 // indirect
|
|
||||||
golang.org/x/term v0.25.0 // indirect
|
|
||||||
golang.org/x/text v0.19.0 // indirect
|
|
||||||
golang.org/x/time v0.5.0 // indirect
|
|
||||||
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
|
|
||||||
google.golang.org/api v0.162.0 // indirect
|
|
||||||
google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect
|
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20241007155032-5fefd90f89a9 // indirect
|
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 // indirect
|
|
||||||
google.golang.org/grpc v1.67.1 // indirect
|
|
||||||
google.golang.org/protobuf v1.35.1 // indirect
|
|
||||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
|
||||||
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
|
|
||||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
|
||||||
gotest.tools/v3 v3.5.1 // indirect
|
|
||||||
lukechampine.com/blake3 v1.2.2 // indirect
|
|
||||||
lukechampine.com/uint128 v1.3.0 // indirect
|
|
||||||
modernc.org/cc/v3 v3.41.0 // indirect
|
|
||||||
modernc.org/ccgo/v3 v3.16.15 // indirect
|
|
||||||
modernc.org/libc v1.29.0 // indirect
|
|
||||||
modernc.org/mathutil v1.6.0 // indirect
|
|
||||||
modernc.org/memory v1.7.2 // indirect
|
|
||||||
modernc.org/opt v0.1.3 // indirect
|
|
||||||
modernc.org/sqlite v1.28.0 // indirect
|
|
||||||
modernc.org/strutil v1.2.0 // indirect
|
|
||||||
modernc.org/token v1.1.0 // indirect
|
|
||||||
nhooyr.io/websocket v1.8.10 // indirect
|
|
||||||
pgregory.net/rapid v1.1.0 // indirect
|
|
||||||
sigs.k8s.io/yaml v1.4.0 // indirect
|
|
||||||
)
|
|
File diff suppressed because it is too large
Load Diff
@ -1,137 +0,0 @@
|
|||||||
package e2e
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
"cosmossdk.io/math"
|
|
||||||
transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"
|
|
||||||
"github.com/strangelove-ventures/interchaintest/v8"
|
|
||||||
"github.com/strangelove-ventures/interchaintest/v8/chain/cosmos"
|
|
||||||
"github.com/strangelove-ventures/interchaintest/v8/ibc"
|
|
||||||
interchaintestrelayer "github.com/strangelove-ventures/interchaintest/v8/relayer"
|
|
||||||
"github.com/strangelove-ventures/interchaintest/v8/testreporter"
|
|
||||||
"github.com/stretchr/testify/require"
|
|
||||||
"go.uber.org/zap/zapcore"
|
|
||||||
"go.uber.org/zap/zaptest"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
ibcPath = "ibc-path"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestIBC(t *testing.T) {
|
|
||||||
t.Parallel()
|
|
||||||
ctx := context.Background()
|
|
||||||
|
|
||||||
cfgA := DefaultChainConfig
|
|
||||||
cfgA.ChainID = cfgA.ChainID + "-1"
|
|
||||||
|
|
||||||
cfgB := DefaultChainConfig
|
|
||||||
cfgB.ChainID = cfgB.ChainID + "-2"
|
|
||||||
|
|
||||||
cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t, zaptest.Level(zapcore.DebugLevel)), []*interchaintest.ChainSpec{
|
|
||||||
{
|
|
||||||
Name: DefaultChainConfig.Name,
|
|
||||||
Version: ChainImage.Version,
|
|
||||||
ChainName: cfgA.ChainID,
|
|
||||||
NumValidators: &NumberVals,
|
|
||||||
NumFullNodes: &NumberFullNodes,
|
|
||||||
ChainConfig: cfgA,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Name: DefaultChainConfig.Name,
|
|
||||||
Version: ChainImage.Version,
|
|
||||||
ChainName: cfgB.ChainID,
|
|
||||||
NumValidators: &NumberVals,
|
|
||||||
NumFullNodes: &NumberFullNodes,
|
|
||||||
ChainConfig: cfgB,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
chains, err := cf.Chains(t.Name())
|
|
||||||
require.NoError(t, err)
|
|
||||||
chainA, chainB := chains[0].(*cosmos.CosmosChain), chains[1].(*cosmos.CosmosChain)
|
|
||||||
|
|
||||||
// Relayer Factory
|
|
||||||
client, network := interchaintest.DockerSetup(t)
|
|
||||||
rf := interchaintest.NewBuiltinRelayerFactory(
|
|
||||||
ibc.CosmosRly,
|
|
||||||
zaptest.NewLogger(t, zaptest.Level(zapcore.DebugLevel)),
|
|
||||||
interchaintestrelayer.CustomDockerImage(RelayerRepo, RelayerVersion, "100:1000"),
|
|
||||||
interchaintestrelayer.StartupFlags("--processor", "events", "--block-history", "100"),
|
|
||||||
)
|
|
||||||
|
|
||||||
r := rf.Build(t, client, network)
|
|
||||||
|
|
||||||
ic := interchaintest.NewInterchain().
|
|
||||||
AddChain(chainA).
|
|
||||||
AddChain(chainB).
|
|
||||||
AddRelayer(r, "relayer").
|
|
||||||
AddLink(interchaintest.InterchainLink{
|
|
||||||
Chain1: chainA,
|
|
||||||
Chain2: chainB,
|
|
||||||
Relayer: r,
|
|
||||||
Path: ibcPath,
|
|
||||||
})
|
|
||||||
|
|
||||||
rep := testreporter.NewNopReporter()
|
|
||||||
eRep := rep.RelayerExecReporter(t)
|
|
||||||
|
|
||||||
// Build interchain
|
|
||||||
require.NoError(t, ic.Build(ctx, eRep, interchaintest.InterchainBuildOptions{
|
|
||||||
TestName: t.Name(),
|
|
||||||
Client: client,
|
|
||||||
NetworkID: network,
|
|
||||||
SkipPathCreation: false,
|
|
||||||
}))
|
|
||||||
|
|
||||||
// Create and Fund User Wallets
|
|
||||||
fundAmount := math.NewInt(10_000_000)
|
|
||||||
users := interchaintest.GetAndFundTestUsers(t, ctx, "default", fundAmount, chainA, chainB)
|
|
||||||
userA := users[0]
|
|
||||||
userB := users[1]
|
|
||||||
|
|
||||||
userAInitial, err := chainA.GetBalance(ctx, userA.FormattedAddress(), chainA.Config().Denom)
|
|
||||||
require.NoError(t, err)
|
|
||||||
require.True(t, userAInitial.Equal(fundAmount))
|
|
||||||
|
|
||||||
// Get Channel ID
|
|
||||||
aInfo, err := r.GetChannels(ctx, eRep, chainA.Config().ChainID)
|
|
||||||
require.NoError(t, err)
|
|
||||||
aChannelID := aInfo[0].ChannelID
|
|
||||||
|
|
||||||
bInfo, err := r.GetChannels(ctx, eRep, chainB.Config().ChainID)
|
|
||||||
require.NoError(t, err)
|
|
||||||
bChannelID := bInfo[0].ChannelID
|
|
||||||
|
|
||||||
// Send Transaction
|
|
||||||
amountToSend := math.NewInt(1_000_000)
|
|
||||||
dstAddress := userB.FormattedAddress()
|
|
||||||
transfer := ibc.WalletAmount{
|
|
||||||
Address: dstAddress,
|
|
||||||
Denom: chainA.Config().Denom,
|
|
||||||
Amount: amountToSend,
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = chainA.SendIBCTransfer(ctx, aChannelID, userA.KeyName(), transfer, ibc.TransferOptions{})
|
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
// relay MsgRecvPacket to chainB, then MsgAcknowledgement back to chainA
|
|
||||||
require.NoError(t, r.Flush(ctx, eRep, ibcPath, aChannelID))
|
|
||||||
|
|
||||||
// test source wallet has decreased funds
|
|
||||||
expectedBal := userAInitial.Sub(amountToSend)
|
|
||||||
aNewBal, err := chainA.GetBalance(ctx, userA.FormattedAddress(), chainA.Config().Denom)
|
|
||||||
require.NoError(t, err)
|
|
||||||
require.True(t, aNewBal.Equal(expectedBal))
|
|
||||||
|
|
||||||
// Trace IBC Denom
|
|
||||||
srcDenomTrace := transfertypes.ParseDenomTrace(transfertypes.GetPrefixedDenom("transfer", bChannelID, chainA.Config().Denom))
|
|
||||||
dstIbcDenom := srcDenomTrace.IBCDenom()
|
|
||||||
|
|
||||||
// Test destination wallet has increased funds
|
|
||||||
bNewBal, err := chainB.GetBalance(ctx, userB.FormattedAddress(), dstIbcDenom)
|
|
||||||
require.NoError(t, err)
|
|
||||||
require.True(t, bNewBal.Equal(amountToSend))
|
|
||||||
}
|
|
@ -1,231 +0,0 @@
|
|||||||
package e2e
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"encoding/json"
|
|
||||||
"testing"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"cosmossdk.io/math"
|
|
||||||
"github.com/strangelove-ventures/interchaintest/v8"
|
|
||||||
"github.com/strangelove-ventures/interchaintest/v8/chain/cosmos"
|
|
||||||
"github.com/strangelove-ventures/interchaintest/v8/ibc"
|
|
||||||
interchaintestrelayer "github.com/strangelove-ventures/interchaintest/v8/relayer"
|
|
||||||
"github.com/strangelove-ventures/interchaintest/v8/testreporter"
|
|
||||||
"github.com/strangelove-ventures/interchaintest/v8/testutil"
|
|
||||||
"github.com/stretchr/testify/require"
|
|
||||||
"go.uber.org/zap/zaptest"
|
|
||||||
|
|
||||||
transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"
|
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
||||||
)
|
|
||||||
|
|
||||||
type PacketMetadata struct {
|
|
||||||
Forward *ForwardMetadata `json:"forward"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ForwardMetadata struct {
|
|
||||||
Receiver string `json:"receiver"`
|
|
||||||
Port string `json:"port"`
|
|
||||||
Channel string `json:"channel"`
|
|
||||||
Timeout time.Duration `json:"timeout"`
|
|
||||||
Retries *uint8 `json:"retries,omitempty"`
|
|
||||||
Next *string `json:"next,omitempty"`
|
|
||||||
RefundSequence *uint64 `json:"refund_sequence,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestPacketForwardMiddleware(t *testing.T) {
|
|
||||||
if testing.Short() {
|
|
||||||
t.Skip()
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
|
||||||
ctx = context.Background()
|
|
||||||
client, network = interchaintest.DockerSetup(t)
|
|
||||||
rep = testreporter.NewNopReporter()
|
|
||||||
eRep = rep.RelayerExecReporter(t)
|
|
||||||
chainID_A, chainID_B, chainID_C = "chain-a", "chain-b", "chain-c"
|
|
||||||
chainA, chainB, chainC *cosmos.CosmosChain
|
|
||||||
)
|
|
||||||
|
|
||||||
// base config which all networks will use as defaults.
|
|
||||||
baseCfg := DefaultChainConfig
|
|
||||||
|
|
||||||
// Set specific chain ids for each so they are their own unique networks
|
|
||||||
baseCfg.ChainID = chainID_A
|
|
||||||
configA := baseCfg
|
|
||||||
|
|
||||||
baseCfg.ChainID = chainID_B
|
|
||||||
configB := baseCfg
|
|
||||||
|
|
||||||
baseCfg.ChainID = chainID_C
|
|
||||||
configC := baseCfg
|
|
||||||
|
|
||||||
// Create chain factory with multiple individual networks.
|
|
||||||
numVals := 1
|
|
||||||
numFullNodes := 0
|
|
||||||
|
|
||||||
cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{
|
|
||||||
{
|
|
||||||
Name: configA.Name,
|
|
||||||
ChainConfig: configA,
|
|
||||||
NumValidators: &numVals,
|
|
||||||
NumFullNodes: &numFullNodes,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Name: configA.Name,
|
|
||||||
ChainConfig: configB,
|
|
||||||
NumValidators: &numVals,
|
|
||||||
NumFullNodes: &numFullNodes,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Name: configA.Name,
|
|
||||||
ChainConfig: configC,
|
|
||||||
NumValidators: &numVals,
|
|
||||||
NumFullNodes: &numFullNodes,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
// Get chains from the chain factory
|
|
||||||
chains, err := cf.Chains(t.Name())
|
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
chainA, chainB, chainC = chains[0].(*cosmos.CosmosChain), chains[1].(*cosmos.CosmosChain), chains[2].(*cosmos.CosmosChain)
|
|
||||||
|
|
||||||
r := interchaintest.NewBuiltinRelayerFactory(
|
|
||||||
ibc.CosmosRly,
|
|
||||||
zaptest.NewLogger(t),
|
|
||||||
interchaintestrelayer.CustomDockerImage(RelayerRepo, RelayerVersion, "100:1000"),
|
|
||||||
interchaintestrelayer.StartupFlags("--processor", "events", "--block-history", "100"),
|
|
||||||
).Build(t, client, network)
|
|
||||||
|
|
||||||
const pathAB = "ab"
|
|
||||||
const pathBC = "bc"
|
|
||||||
|
|
||||||
ic := interchaintest.NewInterchain().
|
|
||||||
AddChain(chainA).
|
|
||||||
AddChain(chainB).
|
|
||||||
AddChain(chainC).
|
|
||||||
AddRelayer(r, "relayer").
|
|
||||||
AddLink(interchaintest.InterchainLink{
|
|
||||||
Chain1: chainA,
|
|
||||||
Chain2: chainB,
|
|
||||||
Relayer: r,
|
|
||||||
Path: pathAB,
|
|
||||||
}).
|
|
||||||
AddLink(interchaintest.InterchainLink{
|
|
||||||
Chain1: chainB,
|
|
||||||
Chain2: chainC,
|
|
||||||
Relayer: r,
|
|
||||||
Path: pathBC,
|
|
||||||
})
|
|
||||||
|
|
||||||
require.NoError(t, ic.Build(ctx, eRep, interchaintest.InterchainBuildOptions{
|
|
||||||
TestName: t.Name(),
|
|
||||||
Client: client,
|
|
||||||
NetworkID: network,
|
|
||||||
BlockDatabaseFile: interchaintest.DefaultBlockDatabaseFilepath(),
|
|
||||||
|
|
||||||
SkipPathCreation: false,
|
|
||||||
}))
|
|
||||||
t.Cleanup(func() {
|
|
||||||
_ = ic.Close()
|
|
||||||
})
|
|
||||||
|
|
||||||
users := interchaintest.GetAndFundTestUsers(t, ctx, t.Name(), GenesisFundsAmount, chainA, chainB, chainC)
|
|
||||||
|
|
||||||
abChan, err := ibc.GetTransferChannel(ctx, r, eRep, chainID_A, chainID_B)
|
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
baChan := abChan.Counterparty
|
|
||||||
|
|
||||||
cbChan, err := ibc.GetTransferChannel(ctx, r, eRep, chainID_C, chainID_B)
|
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
bcChan := cbChan.Counterparty
|
|
||||||
|
|
||||||
// Start the relayer on all paths
|
|
||||||
err = r.StartRelayer(ctx, eRep, pathAB, pathBC)
|
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
t.Cleanup(
|
|
||||||
func() {
|
|
||||||
err := r.StopRelayer(ctx, eRep)
|
|
||||||
if err != nil {
|
|
||||||
t.Logf("an error occurred while stopping the relayer: %s", err)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
// Get original account balances
|
|
||||||
userA, userB, userC := users[0], users[1], users[2]
|
|
||||||
|
|
||||||
var transferAmount math.Int = math.NewInt(100_000)
|
|
||||||
|
|
||||||
// Compose the prefixed denoms and ibc denom for asserting balances
|
|
||||||
firstHopDenom := transfertypes.GetPrefixedDenom(baChan.PortID, baChan.ChannelID, chainA.Config().Denom)
|
|
||||||
secondHopDenom := transfertypes.GetPrefixedDenom(cbChan.PortID, cbChan.ChannelID, firstHopDenom)
|
|
||||||
|
|
||||||
firstHopDenomTrace := transfertypes.ParseDenomTrace(firstHopDenom)
|
|
||||||
secondHopDenomTrace := transfertypes.ParseDenomTrace(secondHopDenom)
|
|
||||||
|
|
||||||
firstHopIBCDenom := firstHopDenomTrace.IBCDenom()
|
|
||||||
secondHopIBCDenom := secondHopDenomTrace.IBCDenom()
|
|
||||||
|
|
||||||
firstHopEscrowAccount := sdk.MustBech32ifyAddressBytes(chainA.Config().Bech32Prefix, transfertypes.GetEscrowAddress(abChan.PortID, abChan.ChannelID))
|
|
||||||
secondHopEscrowAccount := sdk.MustBech32ifyAddressBytes(chainB.Config().Bech32Prefix, transfertypes.GetEscrowAddress(bcChan.PortID, bcChan.ChannelID))
|
|
||||||
|
|
||||||
t.Run("multi-hop a->b->c", func(t *testing.T) {
|
|
||||||
// Send packet from Chain A->Chain B->Chain C
|
|
||||||
|
|
||||||
transfer := ibc.WalletAmount{
|
|
||||||
Address: userB.FormattedAddress(),
|
|
||||||
Denom: chainA.Config().Denom,
|
|
||||||
Amount: transferAmount,
|
|
||||||
}
|
|
||||||
|
|
||||||
firstHopMetadata := &PacketMetadata{
|
|
||||||
Forward: &ForwardMetadata{
|
|
||||||
Receiver: userC.FormattedAddress(),
|
|
||||||
Channel: bcChan.ChannelID,
|
|
||||||
Port: bcChan.PortID,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
memo, err := json.Marshal(firstHopMetadata)
|
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
chainAHeight, err := chainA.Height(ctx)
|
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
transferTx, err := chainA.SendIBCTransfer(ctx, abChan.ChannelID, userA.KeyName(), transfer, ibc.TransferOptions{Memo: string(memo)})
|
|
||||||
require.NoError(t, err)
|
|
||||||
_, err = testutil.PollForAck(ctx, chainA, chainAHeight, chainAHeight+30, transferTx.Packet)
|
|
||||||
require.NoError(t, err)
|
|
||||||
err = testutil.WaitForBlocks(ctx, 1, chainA)
|
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
chainABalance, err := chainA.GetBalance(ctx, userA.FormattedAddress(), chainA.Config().Denom)
|
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
chainBBalance, err := chainB.GetBalance(ctx, userB.FormattedAddress(), firstHopIBCDenom)
|
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
chainCBalance, err := chainC.GetBalance(ctx, userC.FormattedAddress(), secondHopIBCDenom)
|
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
require.Equal(t, GenesisFundsAmount.Sub(transferAmount).Int64(), chainABalance.Int64())
|
|
||||||
require.Equal(t, int64(0), chainBBalance.Int64())
|
|
||||||
require.Equal(t, int64(100000), chainCBalance.Int64())
|
|
||||||
|
|
||||||
firstHopEscrowBalance, err := chainA.GetBalance(ctx, firstHopEscrowAccount, chainA.Config().Denom)
|
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
secondHopEscrowBalance, err := chainB.GetBalance(ctx, secondHopEscrowAccount, firstHopIBCDenom)
|
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
require.Equal(t, transferAmount.Int64(), firstHopEscrowBalance.Int64())
|
|
||||||
require.Equal(t, transferAmount.Int64(), secondHopEscrowBalance.Int64())
|
|
||||||
})
|
|
||||||
}
|
|
@ -1,135 +0,0 @@
|
|||||||
package e2e
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"fmt"
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
||||||
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
|
|
||||||
"github.com/strangelove-ventures/interchaintest/v8/chain/cosmos"
|
|
||||||
"github.com/strangelove-ventures/interchaintest/v8/ibc"
|
|
||||||
"github.com/strangelove-ventures/poa"
|
|
||||||
"github.com/stretchr/testify/require"
|
|
||||||
)
|
|
||||||
|
|
||||||
func POASetPower(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, user ibc.Wallet, valoper string, power int64, flags ...string) (sdk.TxResponse, error) {
|
|
||||||
cmd := TxCommandBuilder(ctx, chain, []string{"tx", "poa", "set-power", valoper, fmt.Sprintf("%d", power)}, user.KeyName(), flags...)
|
|
||||||
return ExecuteTransaction(ctx, chain, cmd)
|
|
||||||
}
|
|
||||||
|
|
||||||
func POARemove(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, user ibc.Wallet, valoper string) (sdk.TxResponse, error) {
|
|
||||||
cmd := TxCommandBuilder(ctx, chain, []string{"tx", "poa", "remove", valoper}, user.KeyName())
|
|
||||||
return ExecuteTransaction(ctx, chain, cmd)
|
|
||||||
}
|
|
||||||
|
|
||||||
func POARemovePending(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, user ibc.Wallet, valoper string) (sdk.TxResponse, error) {
|
|
||||||
cmd := TxCommandBuilder(ctx, chain, []string{"tx", "poa", "remove-pending", valoper}, user.KeyName())
|
|
||||||
return ExecuteTransaction(ctx, chain, cmd)
|
|
||||||
}
|
|
||||||
|
|
||||||
func POACreatePendingValidator(
|
|
||||||
t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, user ibc.Wallet,
|
|
||||||
ed25519PubKey string, moniker string, commissionRate string, commissionMaxRate string, commissionMaxChangeRate string,
|
|
||||||
) (sdk.TxResponse, error) {
|
|
||||||
file := "validator_file.json"
|
|
||||||
|
|
||||||
content := fmt.Sprintf(`{
|
|
||||||
"pubkey": {"@type":"/cosmos.crypto.ed25519.PubKey","key":"%s"},
|
|
||||||
"amount": "0%s",
|
|
||||||
"moniker": "%s",
|
|
||||||
"identity": "",
|
|
||||||
"website": "https://website.com",
|
|
||||||
"security": "security@cosmos.xyz",
|
|
||||||
"details": "description",
|
|
||||||
"commission-rate": "%s",
|
|
||||||
"commission-max-rate": "%s",
|
|
||||||
"commission-max-change-rate": "%s",
|
|
||||||
"min-self-delegation": "1"
|
|
||||||
|
|
||||||
}`, ed25519PubKey, chain.Config().Denom, moniker, commissionRate, commissionMaxRate, commissionMaxChangeRate)
|
|
||||||
|
|
||||||
err := chain.GetNode().WriteFile(ctx, []byte(content), file)
|
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
filePath := fmt.Sprintf("%s/%s", chain.GetNode().HomeDir(), file)
|
|
||||||
cmd := TxCommandBuilder(ctx, chain, []string{"tx", "poa", "create-validator", filePath}, user.KeyName())
|
|
||||||
return ExecuteTransaction(ctx, chain, cmd)
|
|
||||||
}
|
|
||||||
|
|
||||||
func SubmitGovernanceProposalForValidatorChanges(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, user ibc.Wallet, validator string, power uint64, unsafe bool) string {
|
|
||||||
govAddr := "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn"
|
|
||||||
|
|
||||||
powerMsg := []cosmos.ProtoMessage{
|
|
||||||
&poa.MsgSetPower{
|
|
||||||
Sender: govAddr,
|
|
||||||
ValidatorAddress: validator,
|
|
||||||
Power: power,
|
|
||||||
Unsafe: unsafe,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
title := fmt.Sprintf("Update" + validator + "Power")
|
|
||||||
desc := fmt.Sprintf("Updating power for validator %s to %d", validator, power)
|
|
||||||
|
|
||||||
proposal, err := chain.BuildProposal(powerMsg, title, desc, desc, fmt.Sprintf(`50%s`, chain.Config().Denom), user.FormattedAddress(), false)
|
|
||||||
require.NoError(t, err, "error building proposal")
|
|
||||||
|
|
||||||
fmt.Printf("proposal: %+v\n", proposal)
|
|
||||||
|
|
||||||
txProp, err := chain.SubmitProposal(ctx, user.KeyName(), proposal)
|
|
||||||
t.Log("txProp", txProp)
|
|
||||||
require.NoError(t, err, "error submitting proposal")
|
|
||||||
|
|
||||||
return txProp.ProposalID
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetPOAParams(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain) poa.Params {
|
|
||||||
var res poa.ParamsResponse
|
|
||||||
ExecuteQuery(ctx, chain, []string{"query", "poa", "params"}, &res)
|
|
||||||
return res.Params
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetPOAConsensusPower(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, valoperAddr string) int64 {
|
|
||||||
res, err := poa.NewQueryClient(chain.GetNode().GrpcConn).ConsensusPower(ctx, &poa.QueryConsensusPowerRequest{ValidatorAddress: valoperAddr})
|
|
||||||
require.NoError(t, err)
|
|
||||||
return res.ConsensusPower
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetPOAPending(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain) []poa.Validator {
|
|
||||||
res, err := poa.NewQueryClient(chain.GetNode().GrpcConn).PendingValidators(ctx, &poa.QueryPendingValidatorsRequest{})
|
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
return res.Pending
|
|
||||||
}
|
|
||||||
|
|
||||||
func POAUpdateParams(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, user ibc.Wallet, admins []string, gracefulExit bool) (sdk.TxResponse, error) {
|
|
||||||
// admin1,admin2,admin3
|
|
||||||
adminList := ""
|
|
||||||
for _, admin := range admins {
|
|
||||||
adminList += admin + ","
|
|
||||||
}
|
|
||||||
adminList = adminList[:len(adminList)-1]
|
|
||||||
|
|
||||||
gracefulParam := "true"
|
|
||||||
if !gracefulExit {
|
|
||||||
gracefulParam = "false"
|
|
||||||
}
|
|
||||||
|
|
||||||
cmd := TxCommandBuilder(ctx, chain, []string{"tx", "poa", "update-params", adminList, gracefulParam}, user.KeyName())
|
|
||||||
return ExecuteTransaction(ctx, chain, cmd)
|
|
||||||
}
|
|
||||||
|
|
||||||
func POAUpdateStakingParams(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, user ibc.Wallet, sp stakingtypes.Params) (sdk.TxResponse, error) {
|
|
||||||
command := []string{"tx", "poa", "update-staking-params",
|
|
||||||
sp.UnbondingTime.String(),
|
|
||||||
fmt.Sprintf("%d", sp.MaxValidators),
|
|
||||||
fmt.Sprintf("%d", sp.MaxEntries),
|
|
||||||
fmt.Sprintf("%d", sp.HistoricalEntries),
|
|
||||||
sp.BondDenom,
|
|
||||||
fmt.Sprintf("%d", sp.MinCommissionRate),
|
|
||||||
}
|
|
||||||
|
|
||||||
cmd := TxCommandBuilder(ctx, chain, command, user.KeyName())
|
|
||||||
return ExecuteTransaction(ctx, chain, cmd)
|
|
||||||
}
|
|
@ -1,182 +0,0 @@
|
|||||||
package e2e
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"fmt"
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
|
|
||||||
"github.com/strangelove-ventures/interchaintest/v8"
|
|
||||||
"github.com/strangelove-ventures/interchaintest/v8/chain/cosmos"
|
|
||||||
"github.com/strangelove-ventures/interchaintest/v8/ibc"
|
|
||||||
"github.com/strangelove-ventures/interchaintest/v8/testutil"
|
|
||||||
"github.com/strangelove-ventures/poa"
|
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
||||||
"github.com/stretchr/testify/require"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
numPOAVals = 2
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestPOA(t *testing.T) {
|
|
||||||
if testing.Short() {
|
|
||||||
t.Skip("skipping in short mode")
|
|
||||||
}
|
|
||||||
|
|
||||||
// setup base chain
|
|
||||||
chains := interchaintest.CreateChainWithConfig(t, numPOAVals, NumberFullNodes, Name, ChainImage.Version, DefaultChainConfig)
|
|
||||||
chain := chains[0].(*cosmos.CosmosChain)
|
|
||||||
|
|
||||||
enableBlockDB := false
|
|
||||||
ctx, _, _, _ := interchaintest.BuildInitialChain(t, chains, enableBlockDB)
|
|
||||||
|
|
||||||
// setup accounts
|
|
||||||
acc0, err := interchaintest.GetAndFundTestUserWithMnemonic(ctx, "acc0", AccMnemonic, GenesisFundsAmount, chain)
|
|
||||||
require.NoError(t, err)
|
|
||||||
acc1, err := interchaintest.GetAndFundTestUserWithMnemonic(ctx, "acc1", Acc1Mnemonic, GenesisFundsAmount, chain)
|
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
users := interchaintest.GetAndFundTestUsers(t, ctx, t.Name(), GenesisFundsAmount, chain)
|
|
||||||
incorrectUser := users[0]
|
|
||||||
|
|
||||||
// get validator operator addresses
|
|
||||||
vals, err := chain.StakingQueryValidators(ctx, stakingtypes.Bonded.String())
|
|
||||||
require.NoError(t, err)
|
|
||||||
require.Equal(t, len(vals), numPOAVals)
|
|
||||||
|
|
||||||
validators := make([]string, len(vals))
|
|
||||||
for i, v := range vals {
|
|
||||||
validators[i] = v.OperatorAddress
|
|
||||||
}
|
|
||||||
|
|
||||||
// === Test Cases ===
|
|
||||||
testStakingDisabled(t, ctx, chain, validators, acc0, acc1)
|
|
||||||
testPowerErrors(t, ctx, chain, validators, incorrectUser, acc0)
|
|
||||||
testPending(t, ctx, chain, acc0)
|
|
||||||
testRemoveValidator(t, ctx, chain, validators, acc0)
|
|
||||||
}
|
|
||||||
|
|
||||||
func testRemoveValidator(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, validators []string, acc0 ibc.Wallet) {
|
|
||||||
t.Log("\n===== TEST REMOVE VALIDATOR =====")
|
|
||||||
powerOne := int64(9_000_000_000_000)
|
|
||||||
powerTwo := int64(2_500_000)
|
|
||||||
|
|
||||||
res, _ := POASetPower(t, ctx, chain, acc0, validators[0], powerOne, "--unsafe")
|
|
||||||
fmt.Printf("%+v", res)
|
|
||||||
res, _ = POASetPower(t, ctx, chain, acc0, validators[1], powerTwo, "--unsafe")
|
|
||||||
fmt.Printf("%+v", res)
|
|
||||||
|
|
||||||
// decode res.TxHash into a TxResponse
|
|
||||||
txRes, err := chain.GetTransaction(res.TxHash)
|
|
||||||
require.NoError(t, err)
|
|
||||||
fmt.Printf("%+v", txRes)
|
|
||||||
|
|
||||||
if err := testutil.WaitForBlocks(ctx, 2, chain); err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
vals, err := chain.StakingQueryValidators(ctx, stakingtypes.Bonded.String())
|
|
||||||
require.NoError(t, err)
|
|
||||||
require.Equal(t, fmt.Sprintf("%d", powerOne), vals[0].Tokens.String())
|
|
||||||
require.Equal(t, fmt.Sprintf("%d", powerTwo), vals[1].Tokens.String())
|
|
||||||
|
|
||||||
// validate the validators both have a conesnsus-power of /1_000_000
|
|
||||||
p1 := GetPOAConsensusPower(t, ctx, chain, vals[0].OperatorAddress)
|
|
||||||
require.EqualValues(t, powerOne/1_000_000, p1) // = 9000000
|
|
||||||
p2 := GetPOAConsensusPower(t, ctx, chain, vals[1].OperatorAddress)
|
|
||||||
require.EqualValues(t, powerTwo/1_000_000, p2) // = 2
|
|
||||||
|
|
||||||
// remove the 2nd validator (lower power)
|
|
||||||
POARemove(t, ctx, chain, acc0, validators[1])
|
|
||||||
|
|
||||||
// allow the poa.BeginBlocker to update new status
|
|
||||||
if err := testutil.WaitForBlocks(ctx, 5, chain); err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
vals, err = chain.StakingQueryValidators(ctx, stakingtypes.Bonded.String())
|
|
||||||
require.NoError(t, err)
|
|
||||||
require.Equal(t, fmt.Sprintf("%d", powerOne), vals[0].Tokens.String())
|
|
||||||
require.Equal(t, 1, len(vals))
|
|
||||||
|
|
||||||
vals, err = chain.StakingQueryValidators(ctx, stakingtypes.Unbonded.String())
|
|
||||||
require.NoError(t, err)
|
|
||||||
require.Equal(t, "0", vals[0].Tokens.String())
|
|
||||||
require.Equal(t, 1, len(vals))
|
|
||||||
p2 = GetPOAConsensusPower(t, ctx, chain, vals[0].OperatorAddress)
|
|
||||||
require.EqualValues(t, 0, p2)
|
|
||||||
}
|
|
||||||
|
|
||||||
func testStakingDisabled(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, validators []string, acc0, acc1 ibc.Wallet) {
|
|
||||||
t.Log("\n===== TEST STAKING DISABLED =====")
|
|
||||||
|
|
||||||
err := chain.GetNode().StakingDelegate(ctx, acc0.KeyName(), validators[0], "1stake")
|
|
||||||
require.Error(t, err)
|
|
||||||
require.Contains(t, err.Error(), poa.ErrStakingActionNotAllowed.Error())
|
|
||||||
|
|
||||||
granter := acc1
|
|
||||||
grantee := acc0
|
|
||||||
|
|
||||||
// Grant grantee (acc0) the ability to delegate from granter (acc1)
|
|
||||||
res, err := chain.GetNode().AuthzGrant(ctx, granter, grantee.FormattedAddress(), "generic", "--msg-type", "/cosmos.staking.v1beta1.MsgDelegate")
|
|
||||||
require.NoError(t, err)
|
|
||||||
require.EqualValues(t, res.Code, 0)
|
|
||||||
|
|
||||||
// Generate nested message
|
|
||||||
nested := []string{"tx", "staking", "delegate", validators[0], "1stake"}
|
|
||||||
nestedCmd := TxCommandBuilder(ctx, chain, nested, granter.FormattedAddress())
|
|
||||||
|
|
||||||
// Execute nested message via a wrapped Exec
|
|
||||||
_, err = chain.GetNode().AuthzExec(ctx, grantee, nestedCmd)
|
|
||||||
require.Error(t, err)
|
|
||||||
require.Contains(t, err.Error(), poa.ErrStakingActionNotAllowed.Error())
|
|
||||||
}
|
|
||||||
|
|
||||||
func testPending(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, acc0 ibc.Wallet) {
|
|
||||||
t.Log("\n===== TEST PENDING =====")
|
|
||||||
|
|
||||||
res, _ := POACreatePendingValidator(t, ctx, chain, acc0, "pl3Q8OQwtC7G2dSqRqsUrO5VZul7l40I+MKUcejqRsg=", "testval", "0.10", "0.25", "0.05")
|
|
||||||
require.EqualValues(t, 0, res.Code)
|
|
||||||
|
|
||||||
require.NoError(t, testutil.WaitForBlocks(ctx, 2, chain))
|
|
||||||
|
|
||||||
pv := GetPOAPending(t, ctx, chain)
|
|
||||||
require.Equal(t, 1, len(pv))
|
|
||||||
require.Equal(t, "0", pv[0].Tokens.String())
|
|
||||||
require.Equal(t, "1", pv[0].MinSelfDelegation.String())
|
|
||||||
|
|
||||||
res, _ = POARemovePending(t, ctx, chain, acc0, pv[0].OperatorAddress)
|
|
||||||
require.EqualValues(t, 0, res.Code)
|
|
||||||
|
|
||||||
// validate it was removed
|
|
||||||
pv = GetPOAPending(t, ctx, chain)
|
|
||||||
require.Equal(t, 0, len(pv))
|
|
||||||
}
|
|
||||||
|
|
||||||
func testPowerErrors(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, validators []string, incorrectUser ibc.Wallet, admin ibc.Wallet) {
|
|
||||||
t.Log("\n===== TEST POWER ERRORS =====")
|
|
||||||
var res sdk.TxResponse
|
|
||||||
var err error
|
|
||||||
|
|
||||||
t.Run("fail: set-power message from a non authorized user", func(t *testing.T) {
|
|
||||||
res, _ = POASetPower(t, ctx, chain, incorrectUser, validators[1], 1_000_000)
|
|
||||||
res, err := chain.GetTransaction(res.TxHash)
|
|
||||||
require.NoError(t, err)
|
|
||||||
require.Contains(t, res.RawLog, poa.ErrNotAnAuthority.Error())
|
|
||||||
})
|
|
||||||
|
|
||||||
t.Run("fail: set-power message below minimum power requirement (self bond)", func(t *testing.T) {
|
|
||||||
res, err = POASetPower(t, ctx, chain, admin, validators[0], 1)
|
|
||||||
require.Error(t, err) // cli validate error
|
|
||||||
require.Contains(t, err.Error(), poa.ErrPowerBelowMinimum.Error())
|
|
||||||
})
|
|
||||||
|
|
||||||
t.Run("fail: set-power message above 30%% without unsafe flag", func(t *testing.T) {
|
|
||||||
res, _ = POASetPower(t, ctx, chain, admin, validators[0], 9_000_000_000_000_000)
|
|
||||||
res, err := chain.GetTransaction(res.TxHash)
|
|
||||||
require.NoError(t, err)
|
|
||||||
require.Contains(t, res.RawLog, poa.ErrUnsafePower.Error())
|
|
||||||
})
|
|
||||||
}
|
|
@ -1,175 +0,0 @@
|
|||||||
package e2e
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"github.com/cosmos/cosmos-sdk/crypto/keyring"
|
|
||||||
moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil"
|
|
||||||
"github.com/strangelove-ventures/interchaintest/v8"
|
|
||||||
"github.com/strangelove-ventures/interchaintest/v8/chain/cosmos"
|
|
||||||
"github.com/strangelove-ventures/interchaintest/v8/ibc"
|
|
||||||
"github.com/strangelove-ventures/interchaintest/v8/testutil"
|
|
||||||
|
|
||||||
sdkmath "cosmossdk.io/math"
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
||||||
|
|
||||||
globalfee "github.com/strangelove-ventures/globalfee/x/globalfee/types"
|
|
||||||
poa "github.com/strangelove-ventures/poa"
|
|
||||||
tokenfactory "github.com/strangelove-ventures/tokenfactory/x/tokenfactory/types"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
VotingPeriod = "15s"
|
|
||||||
MaxDepositPeriod = "10s"
|
|
||||||
|
|
||||||
Denom = "usnr"
|
|
||||||
Name = "sonr"
|
|
||||||
ChainID = "chainid-1"
|
|
||||||
Binary = "sonrd"
|
|
||||||
|
|
||||||
Bech32 = "idx"
|
|
||||||
|
|
||||||
NumberVals = 1
|
|
||||||
NumberFullNodes = 0
|
|
||||||
GenesisFundsAmount = sdkmath.NewInt(1000_000000) // 1k tokens
|
|
||||||
|
|
||||||
ChainImage = ibc.NewDockerImage("core", "local", "1025:1025")
|
|
||||||
|
|
||||||
DefaultGenesis = []cosmos.GenesisKV{
|
|
||||||
// default
|
|
||||||
cosmos.NewGenesisKV("app_state.gov.params.voting_period", VotingPeriod),
|
|
||||||
cosmos.NewGenesisKV("app_state.gov.params.max_deposit_period", MaxDepositPeriod),
|
|
||||||
cosmos.NewGenesisKV("app_state.gov.params.min_deposit.0.denom", Denom),
|
|
||||||
cosmos.NewGenesisKV("app_state.gov.params.min_deposit.0.amount", "1"),
|
|
||||||
// poa: gov & testing account
|
|
||||||
cosmos.NewGenesisKV("app_state.poa.params.admins", []string{"idx10d07y265gmmuvt4z0w9aw880jnsr700j9kqcfa", "idx1hj5fveer5cjtn4wd6wstzugjfdxzl0xpecp0nd"}),
|
|
||||||
// globalfee: set minimum fee requirements
|
|
||||||
cosmos.NewGenesisKV("app_state.globalfee.params.minimum_gas_prices", sdk.DecCoins{sdk.NewDecCoinFromDec(Denom, sdkmath.LegacyMustNewDecFromStr("0.0"))}),
|
|
||||||
// tokenfactory: set create cost in set denom or in gas usage.
|
|
||||||
cosmos.NewGenesisKV("app_state.tokenfactory.params.denom_creation_fee", nil),
|
|
||||||
cosmos.NewGenesisKV("app_state.tokenfactory.params.denom_creation_gas_consume", 1), // cost 1 gas to create a new denom
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
DefaultChainConfig = ibc.ChainConfig{
|
|
||||||
Images: []ibc.DockerImage{
|
|
||||||
ChainImage,
|
|
||||||
},
|
|
||||||
GasAdjustment: 1.5,
|
|
||||||
ModifyGenesis: cosmos.ModifyGenesis(DefaultGenesis),
|
|
||||||
EncodingConfig: func() *moduletestutil.TestEncodingConfig {
|
|
||||||
cfg := cosmos.DefaultEncoding()
|
|
||||||
// TODO: add encoding types here for the modules you want to use
|
|
||||||
tokenfactory.RegisterInterfaces(cfg.InterfaceRegistry)
|
|
||||||
globalfee.RegisterInterfaces(cfg.InterfaceRegistry)
|
|
||||||
poa.RegisterInterfaces(cfg.InterfaceRegistry)
|
|
||||||
return &cfg
|
|
||||||
}(),
|
|
||||||
Type: "cosmos",
|
|
||||||
Name: Name,
|
|
||||||
ChainID: ChainID,
|
|
||||||
Bin: Binary,
|
|
||||||
Bech32Prefix: Bech32,
|
|
||||||
Denom: Denom,
|
|
||||||
CoinType: "118",
|
|
||||||
GasPrices: "0" + Denom,
|
|
||||||
TrustingPeriod: "336h",
|
|
||||||
}
|
|
||||||
|
|
||||||
DefaultChainSpec = interchaintest.ChainSpec{
|
|
||||||
Name: Name,
|
|
||||||
ChainName: Name,
|
|
||||||
Version: ChainImage.Version,
|
|
||||||
ChainConfig: DefaultChainConfig,
|
|
||||||
NumValidators: &NumberVals,
|
|
||||||
NumFullNodes: &NumberFullNodes,
|
|
||||||
}
|
|
||||||
|
|
||||||
// cosmos1hj5fveer5cjtn4wd6wstzugjfdxzl0xpxvjjvr - test_node.sh
|
|
||||||
AccMnemonic = "decorate bright ozone fork gallery riot bus exhaust worth way bone indoor calm squirrel merry zero scheme cotton until shop any excess stage laundry"
|
|
||||||
Acc1Mnemonic = "wealth flavor believe regret funny network recall kiss grape useless pepper cram hint member few certain unveil rather brick bargain curious require crowd raise"
|
|
||||||
|
|
||||||
RelayerRepo = "ghcr.io/cosmos/relayer"
|
|
||||||
RelayerVersion = "main"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Other Helpers
|
|
||||||
func ExecuteQuery(ctx context.Context, chain *cosmos.CosmosChain, cmd []string, i interface{}, extraFlags ...string) {
|
|
||||||
flags := []string{
|
|
||||||
"--node", chain.GetRPCAddress(),
|
|
||||||
"--output=json",
|
|
||||||
}
|
|
||||||
flags = append(flags, extraFlags...)
|
|
||||||
|
|
||||||
ExecuteExec(ctx, chain, cmd, i, flags...)
|
|
||||||
}
|
|
||||||
func ExecuteExec(ctx context.Context, chain *cosmos.CosmosChain, cmd []string, i interface{}, extraFlags ...string) {
|
|
||||||
command := []string{chain.Config().Bin}
|
|
||||||
command = append(command, cmd...)
|
|
||||||
command = append(command, extraFlags...)
|
|
||||||
fmt.Println(command)
|
|
||||||
|
|
||||||
stdout, _, err := chain.Exec(ctx, command, nil)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Println(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
fmt.Println(string(stdout))
|
|
||||||
if err := json.Unmarshal(stdout, &i); err != nil {
|
|
||||||
fmt.Println(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Executes a command from CommandBuilder
|
|
||||||
func ExecuteTransaction(ctx context.Context, chain *cosmos.CosmosChain, cmd []string) (sdk.TxResponse, error) {
|
|
||||||
var err error
|
|
||||||
var stdout []byte
|
|
||||||
|
|
||||||
stdout, _, err = chain.Exec(ctx, cmd, nil)
|
|
||||||
if err != nil {
|
|
||||||
return sdk.TxResponse{}, err
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := testutil.WaitForBlocks(ctx, 2, chain); err != nil {
|
|
||||||
return sdk.TxResponse{}, err
|
|
||||||
}
|
|
||||||
|
|
||||||
var res sdk.TxResponse
|
|
||||||
if err := json.Unmarshal(stdout, &res); err != nil {
|
|
||||||
return res, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return res, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func TxCommandBuilder(ctx context.Context, chain *cosmos.CosmosChain, cmd []string, fromUser string, extraFlags ...string) []string {
|
|
||||||
return TxCommandBuilderNode(ctx, chain.GetNode(), cmd, fromUser, extraFlags...)
|
|
||||||
}
|
|
||||||
|
|
||||||
func TxCommandBuilderNode(ctx context.Context, node *cosmos.ChainNode, cmd []string, fromUser string, extraFlags ...string) []string {
|
|
||||||
command := []string{node.Chain.Config().Bin}
|
|
||||||
command = append(command, cmd...)
|
|
||||||
command = append(command, "--node", node.Chain.GetRPCAddress())
|
|
||||||
command = append(command, "--home", node.HomeDir())
|
|
||||||
command = append(command, "--chain-id", node.Chain.Config().ChainID)
|
|
||||||
command = append(command, "--from", fromUser)
|
|
||||||
command = append(command, "--keyring-backend", keyring.BackendTest)
|
|
||||||
command = append(command, "--output=json")
|
|
||||||
command = append(command, "--yes")
|
|
||||||
|
|
||||||
gasFlag := false
|
|
||||||
for _, flag := range extraFlags {
|
|
||||||
if flag == "--gas" {
|
|
||||||
gasFlag = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if !gasFlag {
|
|
||||||
command = append(command, "--gas", "500000")
|
|
||||||
}
|
|
||||||
|
|
||||||
command = append(command, extraFlags...)
|
|
||||||
return command
|
|
||||||
}
|
|
@ -1,63 +0,0 @@
|
|||||||
package e2e
|
|
||||||
|
|
||||||
import (
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
"github.com/strangelove-ventures/interchaintest/v8"
|
|
||||||
"github.com/strangelove-ventures/interchaintest/v8/chain/cosmos"
|
|
||||||
"github.com/stretchr/testify/require"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestTokenFactory(t *testing.T) {
|
|
||||||
if testing.Short() {
|
|
||||||
t.Skip("skipping in short mode")
|
|
||||||
}
|
|
||||||
|
|
||||||
// setup base chain
|
|
||||||
chains := interchaintest.CreateChainWithConfig(t, NumberVals, NumberFullNodes, Name, ChainImage.Version, DefaultChainConfig)
|
|
||||||
chain := chains[0].(*cosmos.CosmosChain)
|
|
||||||
ctx, ic, _, _ := interchaintest.BuildInitialChain(t, chains, false)
|
|
||||||
|
|
||||||
users := interchaintest.GetAndFundTestUsers(t, ctx, "default", GenesisFundsAmount, chain, chain)
|
|
||||||
user := users[0]
|
|
||||||
user2 := users[1]
|
|
||||||
|
|
||||||
uaddr := user.FormattedAddress()
|
|
||||||
uaddr2 := user2.FormattedAddress()
|
|
||||||
|
|
||||||
node := chain.GetNode()
|
|
||||||
|
|
||||||
tfDenom, _, err := node.TokenFactoryCreateDenom(ctx, user, "ictestdenom", 2_500_00)
|
|
||||||
t.Log("TF Denom: ", tfDenom)
|
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
t.Log("Mint TF Denom to user")
|
|
||||||
node.TokenFactoryMintDenom(ctx, user.FormattedAddress(), tfDenom, 100)
|
|
||||||
if balance, err := chain.GetBalance(ctx, uaddr, tfDenom); err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
} else if balance.Int64() != 100 {
|
|
||||||
t.Fatal("balance not 100")
|
|
||||||
}
|
|
||||||
|
|
||||||
t.Log("Mint TF Denom to another user")
|
|
||||||
node.TokenFactoryMintDenomTo(ctx, user.FormattedAddress(), tfDenom, 70, user2.FormattedAddress())
|
|
||||||
if balance, err := chain.GetBalance(ctx, uaddr2, tfDenom); err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
} else if balance.Int64() != 70 {
|
|
||||||
t.Fatal("balance not 70")
|
|
||||||
}
|
|
||||||
|
|
||||||
t.Log("Change admin to uaddr2")
|
|
||||||
_, err = node.TokenFactoryChangeAdmin(ctx, user.KeyName(), tfDenom, uaddr2)
|
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
// ensure the admin is the contract
|
|
||||||
res, err := chain.TokenFactoryQueryAdmin(ctx, tfDenom)
|
|
||||||
require.NoError(t, err)
|
|
||||||
require.EqualValues(t, res.AuthorityMetadata.Admin, uaddr2, "admin not uaddr2. Did not properly transfer.")
|
|
||||||
|
|
||||||
t.Cleanup(func() {
|
|
||||||
_ = ic.Close()
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
|
@ -7,7 +7,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
templ InitialView() {
|
templ InitialView() {
|
||||||
@layout.Root("Sonr.ID") {
|
@layout.View("Sonr.ID") {
|
||||||
@card.Container() {
|
@card.Container() {
|
||||||
@text.TitleDescription("Sonr.ID", "The decentralized identity layer for the web.")
|
@text.TitleDescription("Sonr.ID", "The decentralized identity layer for the web.")
|
||||||
<div class="pt-1.5 mb-3 flex flex-col items-center justify-center h-full">
|
<div class="pt-1.5 mb-3 flex flex-col items-center justify-center h-full">
|
||||||
@ -17,7 +17,7 @@ templ InitialView() {
|
|||||||
<sl-icon slot="suffix" library="sonr" name="arrow-right"></sl-icon>
|
<sl-icon slot="suffix" library="sonr" name="arrow-right"></sl-icon>
|
||||||
</sl-button>
|
</sl-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="pt-4 flex flex-row items-center justify-center h-full gap-3">
|
<div class="pt-1.5 flex flex-row items-center justify-center h-full gap-3">
|
||||||
<sl-button circle outline href="https://sonr.io">
|
<sl-button circle outline href="https://sonr.io">
|
||||||
<sl-icon name="home" library="sonr" label="Home"></sl-icon>
|
<sl-icon name="home" library="sonr" label="Home"></sl-icon>
|
||||||
</sl-button>
|
</sl-button>
|
||||||
@ -33,7 +33,7 @@ templ InitialView() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
templ ReturningView() {
|
templ ReturningView() {
|
||||||
@layout.Root("Login | Sonr.ID") {
|
@layout.View("Login | Sonr.ID") {
|
||||||
@card.Container() {
|
@card.Container() {
|
||||||
@text.TitleDescription("Welcome Back!", "Continue with your existing Sonr.ID.")
|
@text.TitleDescription("Welcome Back!", "Continue with your existing Sonr.ID.")
|
||||||
<div class="pt-3 flex flex-col items-center justify-center h-full">
|
<div class="pt-3 flex flex-col items-center justify-center h-full">
|
||||||
|
@ -63,7 +63,7 @@ func InitialView() templ.Component {
|
|||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" <div class=\"pt-1.5 mb-3 flex flex-col items-center justify-center h-full\"><sl-button size=\"large\" hx-target=\"#container\" hx-get=\"/register\" hx-push-url=\"/register\" type=\"button\"><sl-icon slot=\"prefix\" library=\"sonr\" name=\"sonr\"></sl-icon> Get Started <sl-icon slot=\"suffix\" library=\"sonr\" name=\"arrow-right\"></sl-icon></sl-button></div><div class=\"pt-4 flex flex-row items-center justify-center h-full gap-3\"><sl-button circle outline href=\"https://sonr.io\"><sl-icon name=\"home\" library=\"sonr\" label=\"Home\"></sl-icon></sl-button> <sl-button circle outline href=\"https://onsonr.dev\"><sl-icon name=\"docs\" library=\"sonr\" label=\"Docs\"></sl-icon></sl-button> <sl-button circle outline href=\"https://github.com/onsonr/sonr\"><sl-icon name=\"social-github\" library=\"sonr\" label=\"Open Source\"></sl-icon></sl-button></div>")
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" <div class=\"pt-1.5 mb-3 flex flex-col items-center justify-center h-full\"><sl-button size=\"large\" hx-target=\"#container\" hx-get=\"/register\" hx-push-url=\"/register\" type=\"button\"><sl-icon slot=\"prefix\" library=\"sonr\" name=\"sonr\"></sl-icon> Get Started <sl-icon slot=\"suffix\" library=\"sonr\" name=\"arrow-right\"></sl-icon></sl-button></div><div class=\"pt-1.5 flex flex-row items-center justify-center h-full gap-3\"><sl-button circle outline href=\"https://sonr.io\"><sl-icon name=\"home\" library=\"sonr\" label=\"Home\"></sl-icon></sl-button> <sl-button circle outline href=\"https://onsonr.dev\"><sl-icon name=\"docs\" library=\"sonr\" label=\"Docs\"></sl-icon></sl-button> <sl-button circle outline href=\"https://github.com/onsonr/sonr\"><sl-icon name=\"social-github\" library=\"sonr\" label=\"Open Source\"></sl-icon></sl-button></div>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@ -75,7 +75,7 @@ func InitialView() templ.Component {
|
|||||||
}
|
}
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
})
|
})
|
||||||
templ_7745c5c3_Err = layout.Root("Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = layout.View("Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@ -144,7 +144,7 @@ func ReturningView() templ.Component {
|
|||||||
}
|
}
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
})
|
})
|
||||||
templ_7745c5c3_Err = layout.Root("Login | Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var5), templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = layout.View("Login | Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var5), templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package register
|
|||||||
import (
|
import (
|
||||||
"github.com/onsonr/sonr/internal/nebula/card"
|
"github.com/onsonr/sonr/internal/nebula/card"
|
||||||
"github.com/onsonr/sonr/internal/nebula/form"
|
"github.com/onsonr/sonr/internal/nebula/form"
|
||||||
|
"github.com/onsonr/sonr/internal/nebula/input"
|
||||||
)
|
)
|
||||||
|
|
||||||
templ formCreateProfile(action string, method string, data CreateProfileData) {
|
templ formCreateProfile(action string, method string, data CreateProfileData) {
|
||||||
@ -11,9 +12,9 @@ templ formCreateProfile(action string, method string, data CreateProfileData) {
|
|||||||
@form.Header() {
|
@form.Header() {
|
||||||
<sl-progress-bar value="50"></sl-progress-bar>
|
<sl-progress-bar value="50"></sl-progress-bar>
|
||||||
}
|
}
|
||||||
@form.InputName()
|
@input.Name()
|
||||||
@form.InputHandle()
|
@input.Handle()
|
||||||
@form.InputHumanSlider(data.FirstNumber, data.LastNumber)
|
@input.HumanSlider(data.FirstNumber, data.LastNumber)
|
||||||
@form.Footer() {
|
@form.Footer() {
|
||||||
@form.CancelButton()
|
@form.CancelButton()
|
||||||
@form.SubmitButton("Next")
|
@form.SubmitButton("Next")
|
||||||
@ -31,9 +32,9 @@ templ formRegisterPasskey(action, method string, data RegisterPasskeyData) {
|
|||||||
@card.SonrProfile(data.Address, data.Name, data.Handle, data.CreationBlock)
|
@card.SonrProfile(data.Address, data.Name, data.Handle, data.CreationBlock)
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@form.InputCoinSelect()
|
@input.CoinSelect()
|
||||||
<div slot="footer" class="space-y-2">
|
<div slot="footer" class="space-y-2">
|
||||||
@form.InputPasskey(data.Address, data.Handle, data.Challenge)
|
@input.Passkey(data.Address, data.Handle, data.Challenge)
|
||||||
<sl-button href="/" style="width: 100%;" outline>
|
<sl-button href="/" style="width: 100%;" outline>
|
||||||
<sl-icon slot="prefix" name="x-lg"></sl-icon>
|
<sl-icon slot="prefix" name="x-lg"></sl-icon>
|
||||||
Cancel
|
Cancel
|
||||||
|
@ -11,6 +11,7 @@ import templruntime "github.com/a-h/templ/runtime"
|
|||||||
import (
|
import (
|
||||||
"github.com/onsonr/sonr/internal/nebula/card"
|
"github.com/onsonr/sonr/internal/nebula/card"
|
||||||
"github.com/onsonr/sonr/internal/nebula/form"
|
"github.com/onsonr/sonr/internal/nebula/form"
|
||||||
|
"github.com/onsonr/sonr/internal/nebula/input"
|
||||||
)
|
)
|
||||||
|
|
||||||
func formCreateProfile(action string, method string, data CreateProfileData) templ.Component {
|
func formCreateProfile(action string, method string, data CreateProfileData) templ.Component {
|
||||||
@ -84,7 +85,7 @@ func formCreateProfile(action string, method string, data CreateProfileData) tem
|
|||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = form.InputName().Render(ctx, templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = input.Name().Render(ctx, templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@ -92,7 +93,7 @@ func formCreateProfile(action string, method string, data CreateProfileData) tem
|
|||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = form.InputHandle().Render(ctx, templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = input.Handle().Render(ctx, templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@ -100,7 +101,7 @@ func formCreateProfile(action string, method string, data CreateProfileData) tem
|
|||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = form.InputHumanSlider(data.FirstNumber, data.LastNumber).Render(ctx, templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = input.HumanSlider(data.FirstNumber, data.LastNumber).Render(ctx, templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@ -191,7 +192,7 @@ func formRegisterPasskey(action, method string, data RegisterPasskeyData) templ.
|
|||||||
var templ_7745c5c3_Var8 string
|
var templ_7745c5c3_Var8 string
|
||||||
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(method)
|
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(method)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gateway/handlers/register/forms.templ`, Line: 26, Col: 55}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gateway/handlers/register/forms.templ`, Line: 27, Col: 55}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
@ -209,7 +210,7 @@ func formRegisterPasskey(action, method string, data RegisterPasskeyData) templ.
|
|||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = form.InputCoinSelect().Render(ctx, templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = input.CoinSelect().Render(ctx, templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@ -217,7 +218,7 @@ func formRegisterPasskey(action, method string, data RegisterPasskeyData) templ.
|
|||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = form.InputPasskey(data.Address, data.Handle, data.Challenge).Render(ctx, templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = input.Passkey(data.Address, data.Handle, data.Challenge).Render(ctx, templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
|
@ -1,94 +0,0 @@
|
|||||||
package register
|
|
||||||
|
|
||||||
templ passkeyDropzone(addr string, userHandle string, challenge string) {
|
|
||||||
<sl-button style="width: 100%;" onclick={ createPasskey(addr, userHandle, challenge) }>
|
|
||||||
<sl-icon slot="prefix" name="passkey" library="sonr" style="font-size: 24px;" class="text-neutral-500"></sl-icon>
|
|
||||||
Register Passkey
|
|
||||||
</sl-button>
|
|
||||||
}
|
|
||||||
|
|
||||||
script createPasskey(userId string, userHandle string, challenge string) {
|
|
||||||
const publicKey = {
|
|
||||||
challenge: Uint8Array.from(challenge, (c) => c.charCodeAt(0)),
|
|
||||||
rp: {
|
|
||||||
name: "Sonr.ID",
|
|
||||||
},
|
|
||||||
user: {
|
|
||||||
// Assuming that userId is ASCII-only
|
|
||||||
id: Uint8Array.from(userId, (c) => c.charCodeAt(0)),
|
|
||||||
name: userId,
|
|
||||||
displayName: userHandle,
|
|
||||||
},
|
|
||||||
pubKeyCredParams: [
|
|
||||||
{
|
|
||||||
type: "public-key",
|
|
||||||
alg: -7, // "ES256"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: "public-key",
|
|
||||||
alg: -257, // "RS256"
|
|
||||||
},
|
|
||||||
],
|
|
||||||
authenticatorSelection: {
|
|
||||||
userVerification: "required",
|
|
||||||
residentKey: "required",
|
|
||||||
authenticatorAttachment: "platform",
|
|
||||||
},
|
|
||||||
timeout: 60000, // 1 minute
|
|
||||||
extensions: {
|
|
||||||
payment: {
|
|
||||||
isPayment: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
// Helper function to convert ArrayBuffer to Base64URL string
|
|
||||||
function arrayBufferToBase64URL(buffer) {
|
|
||||||
const bytes = new Uint8Array(buffer);
|
|
||||||
let str = '';
|
|
||||||
bytes.forEach(byte => { str += String.fromCharCode(byte) });
|
|
||||||
return btoa(str)
|
|
||||||
.replace(/\+/g, '-')
|
|
||||||
.replace(/\//g, '_')
|
|
||||||
.replace(/=/g, '');
|
|
||||||
}
|
|
||||||
|
|
||||||
navigator.credentials
|
|
||||||
.create({ publicKey })
|
|
||||||
.then((newCredentialInfo) => {
|
|
||||||
if (!(newCredentialInfo instanceof PublicKeyCredential)) {
|
|
||||||
throw new Error('Received credential is not a PublicKeyCredential');
|
|
||||||
}
|
|
||||||
|
|
||||||
const response = newCredentialInfo.response;
|
|
||||||
if (!(response instanceof AuthenticatorAttestationResponse)) {
|
|
||||||
throw new Error('Response is not an AuthenticatorAttestationResponse');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert the credential data to a cross-platform compatible format
|
|
||||||
const credentialJSON = {
|
|
||||||
id: newCredentialInfo.id,
|
|
||||||
rawId: arrayBufferToBase64URL(newCredentialInfo.rawId),
|
|
||||||
type: newCredentialInfo.type,
|
|
||||||
authenticatorAttachment: newCredentialInfo.authenticatorAttachment || null,
|
|
||||||
transports: Array.isArray(response.getTransports) ? response.getTransports() : [],
|
|
||||||
clientExtensionResults: newCredentialInfo.getClientExtensionResults(),
|
|
||||||
response: {
|
|
||||||
attestationObject: arrayBufferToBase64URL(response.attestationObject),
|
|
||||||
clientDataJSON: arrayBufferToBase64URL(response.clientDataJSON)
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Set the form value with the stringified credential data
|
|
||||||
const credentialInput = document.getElementById('credential-data');
|
|
||||||
credentialInput.value = JSON.stringify(credentialJSON);
|
|
||||||
|
|
||||||
// Submit the form
|
|
||||||
const form = document.getElementById('passkey-form');
|
|
||||||
form.submit();
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
console.error('Passkey creation failed:', err);
|
|
||||||
alert(`Failed to create passkey: ${err.message || 'Unknown error'}`);
|
|
||||||
});
|
|
||||||
}
|
|
@ -1,145 +0,0 @@
|
|||||||
// Code generated by templ - DO NOT EDIT.
|
|
||||||
|
|
||||||
// templ: version: v0.2.793
|
|
||||||
package register
|
|
||||||
|
|
||||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
|
||||||
|
|
||||||
import "github.com/a-h/templ"
|
|
||||||
import templruntime "github.com/a-h/templ/runtime"
|
|
||||||
|
|
||||||
func passkeyDropzone(addr string, userHandle string, challenge string) templ.Component {
|
|
||||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
|
||||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
|
||||||
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
|
||||||
return templ_7745c5c3_CtxErr
|
|
||||||
}
|
|
||||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
|
||||||
if !templ_7745c5c3_IsBuffer {
|
|
||||||
defer func() {
|
|
||||||
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
|
||||||
if templ_7745c5c3_Err == nil {
|
|
||||||
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
}
|
|
||||||
ctx = templ.InitializeContext(ctx)
|
|
||||||
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
|
|
||||||
if templ_7745c5c3_Var1 == nil {
|
|
||||||
templ_7745c5c3_Var1 = templ.NopComponent
|
|
||||||
}
|
|
||||||
ctx = templ.ClearChildren(ctx)
|
|
||||||
templ_7745c5c3_Err = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, createPasskey(addr, userHandle, challenge))
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<sl-button style=\"width: 100%;\" onclick=\"")
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
var templ_7745c5c3_Var2 templ.ComponentScript = createPasskey(addr, userHandle, challenge)
|
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var2.Call)
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"><sl-icon slot=\"prefix\" name=\"passkey\" library=\"sonr\" style=\"font-size: 24px;\" class=\"text-neutral-500\"></sl-icon> Register Passkey</sl-button>")
|
|
||||||
if templ_7745c5c3_Err != nil {
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
}
|
|
||||||
return templ_7745c5c3_Err
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func createPasskey(userId string, userHandle string, challenge string) templ.ComponentScript {
|
|
||||||
return templ.ComponentScript{
|
|
||||||
Name: `__templ_createPasskey_18a8`,
|
|
||||||
Function: `function __templ_createPasskey_18a8(userId, userHandle, challenge){const publicKey = {
|
|
||||||
challenge: Uint8Array.from(challenge, (c) => c.charCodeAt(0)),
|
|
||||||
rp: {
|
|
||||||
name: "Sonr.ID",
|
|
||||||
},
|
|
||||||
user: {
|
|
||||||
// Assuming that userId is ASCII-only
|
|
||||||
id: Uint8Array.from(userId, (c) => c.charCodeAt(0)),
|
|
||||||
name: userId,
|
|
||||||
displayName: userHandle,
|
|
||||||
},
|
|
||||||
pubKeyCredParams: [
|
|
||||||
{
|
|
||||||
type: "public-key",
|
|
||||||
alg: -7, // "ES256"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: "public-key",
|
|
||||||
alg: -257, // "RS256"
|
|
||||||
},
|
|
||||||
],
|
|
||||||
authenticatorSelection: {
|
|
||||||
userVerification: "required",
|
|
||||||
residentKey: "required",
|
|
||||||
authenticatorAttachment: "platform",
|
|
||||||
},
|
|
||||||
timeout: 60000, // 1 minute
|
|
||||||
extensions: {
|
|
||||||
payment: {
|
|
||||||
isPayment: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
// Helper function to convert ArrayBuffer to Base64URL string
|
|
||||||
function arrayBufferToBase64URL(buffer) {
|
|
||||||
const bytes = new Uint8Array(buffer);
|
|
||||||
let str = '';
|
|
||||||
bytes.forEach(byte => { str += String.fromCharCode(byte) });
|
|
||||||
return btoa(str)
|
|
||||||
.replace(/\+/g, '-')
|
|
||||||
.replace(/\//g, '_')
|
|
||||||
.replace(/=/g, '');
|
|
||||||
}
|
|
||||||
|
|
||||||
navigator.credentials
|
|
||||||
.create({ publicKey })
|
|
||||||
.then((newCredentialInfo) => {
|
|
||||||
if (!(newCredentialInfo instanceof PublicKeyCredential)) {
|
|
||||||
throw new Error('Received credential is not a PublicKeyCredential');
|
|
||||||
}
|
|
||||||
|
|
||||||
const response = newCredentialInfo.response;
|
|
||||||
if (!(response instanceof AuthenticatorAttestationResponse)) {
|
|
||||||
throw new Error('Response is not an AuthenticatorAttestationResponse');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert the credential data to a cross-platform compatible format
|
|
||||||
const credentialJSON = {
|
|
||||||
id: newCredentialInfo.id,
|
|
||||||
rawId: arrayBufferToBase64URL(newCredentialInfo.rawId),
|
|
||||||
type: newCredentialInfo.type,
|
|
||||||
authenticatorAttachment: newCredentialInfo.authenticatorAttachment || null,
|
|
||||||
transports: Array.isArray(response.getTransports) ? response.getTransports() : [],
|
|
||||||
clientExtensionResults: newCredentialInfo.getClientExtensionResults(),
|
|
||||||
response: {
|
|
||||||
attestationObject: arrayBufferToBase64URL(response.attestationObject),
|
|
||||||
clientDataJSON: arrayBufferToBase64URL(response.clientDataJSON)
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Set the form value with the stringified credential data
|
|
||||||
const credentialInput = document.getElementById('credential-data');
|
|
||||||
credentialInput.value = JSON.stringify(credentialJSON);
|
|
||||||
|
|
||||||
// Submit the form
|
|
||||||
const form = document.getElementById('passkey-form');
|
|
||||||
form.submit();
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
console.error('Passkey creation failed:', err);
|
|
||||||
alert(` + "`" + `Failed to create passkey: ${err.message || 'Unknown error'}` + "`" + `);
|
|
||||||
});
|
|
||||||
}`,
|
|
||||||
Call: templ.SafeScript(`__templ_createPasskey_18a8`, userId, userHandle, challenge),
|
|
||||||
CallInline: templ.SafeScriptInline(`__templ_createPasskey_18a8`, userId, userHandle, challenge),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ = templruntime.GeneratedTemplate
|
|
@ -7,7 +7,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
templ ProfileFormView(data CreateProfileData) {
|
templ ProfileFormView(data CreateProfileData) {
|
||||||
@layout.Root("New Profile | Sonr.ID") {
|
@layout.View("New Profile | Sonr.ID") {
|
||||||
@card.Container() {
|
@card.Container() {
|
||||||
@text.TitleDescription("Basic Info", "Tell us a little about yourself.")
|
@text.TitleDescription("Basic Info", "Tell us a little about yourself.")
|
||||||
@formCreateProfile("/register/start", "POST", data)
|
@formCreateProfile("/register/start", "POST", data)
|
||||||
@ -16,7 +16,7 @@ templ ProfileFormView(data CreateProfileData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
templ LinkCredentialView(data RegisterPasskeyData) {
|
templ LinkCredentialView(data RegisterPasskeyData) {
|
||||||
@layout.Root("Register | Sonr.ID") {
|
@layout.View("Register | Sonr.ID") {
|
||||||
@card.Container() {
|
@card.Container() {
|
||||||
@text.TitleDescription("Link a PassKey", "This will be used to login to your vault.")
|
@text.TitleDescription("Link a PassKey", "This will be used to login to your vault.")
|
||||||
@formRegisterPasskey("/register/finish", "POST", data)
|
@formRegisterPasskey("/register/finish", "POST", data)
|
||||||
@ -25,7 +25,7 @@ templ LinkCredentialView(data RegisterPasskeyData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
templ LoadingVaultView() {
|
templ LoadingVaultView() {
|
||||||
@layout.Root("Loading... | Sonr.ID") {
|
@layout.View("Loading... | Sonr.ID") {
|
||||||
@card.Container() {
|
@card.Container() {
|
||||||
@text.TitleDescription("Loading Vault", "This will be used to login to your vault.")
|
@text.TitleDescription("Loading Vault", "This will be used to login to your vault.")
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ func ProfileFormView(data CreateProfileData) templ.Component {
|
|||||||
}
|
}
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
})
|
})
|
||||||
templ_7745c5c3_Err = layout.Root("New Profile | Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = layout.View("New Profile | Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@ -152,7 +152,7 @@ func LinkCredentialView(data RegisterPasskeyData) templ.Component {
|
|||||||
}
|
}
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
})
|
})
|
||||||
templ_7745c5c3_Err = layout.Root("Register | Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var5), templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = layout.View("Register | Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var5), templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@ -217,7 +217,7 @@ func LoadingVaultView() templ.Component {
|
|||||||
}
|
}
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
})
|
})
|
||||||
templ_7745c5c3_Err = layout.Root("Loading... | Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var8), templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = layout.View("Loading... | Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var8), templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ templ Header() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
templ Body() {
|
templ Body() {
|
||||||
<sl-card class="card-form max-w-lg">
|
<sl-card class="card-form max-w-lg mx-auto">
|
||||||
{ children... }
|
{ children... }
|
||||||
<style>
|
<style>
|
||||||
.card-form {
|
.card-form {
|
@ -45,7 +45,7 @@ func Root(action, method, id string) templ.Component {
|
|||||||
var templ_7745c5c3_Var3 string
|
var templ_7745c5c3_Var3 string
|
||||||
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(method)
|
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(method)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/nebula/form/layout.templ`, Line: 4, Col: 55}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/nebula/form/base.templ`, Line: 4, Col: 55}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
@ -58,7 +58,7 @@ func Root(action, method, id string) templ.Component {
|
|||||||
var templ_7745c5c3_Var4 string
|
var templ_7745c5c3_Var4 string
|
||||||
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(id)
|
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(id)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/nebula/form/layout.templ`, Line: 4, Col: 65}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/nebula/form/base.templ`, Line: 4, Col: 65}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
@ -138,7 +138,7 @@ func Body() templ.Component {
|
|||||||
templ_7745c5c3_Var6 = templ.NopComponent
|
templ_7745c5c3_Var6 = templ.NopComponent
|
||||||
}
|
}
|
||||||
ctx = templ.ClearChildren(ctx)
|
ctx = templ.ClearChildren(ctx)
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<sl-card class=\"card-form max-w-lg\">")
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<sl-card class=\"card-form max-w-lg mx-auto\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@ -248,7 +248,7 @@ func SubmitButton(text string) templ.Component {
|
|||||||
var templ_7745c5c3_Var10 string
|
var templ_7745c5c3_Var10 string
|
||||||
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(text)
|
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(text)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/nebula/form/layout.templ`, Line: 55, Col: 8}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/nebula/form/base.templ`, Line: 55, Col: 8}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
@ -1,4 +1,4 @@
|
|||||||
package form
|
package input
|
||||||
|
|
||||||
type Coin struct {
|
type Coin struct {
|
||||||
Ticker string
|
Ticker string
|
||||||
@ -23,7 +23,7 @@ var defaultCoins = []Coin{
|
|||||||
{Ticker: "AXL", Name: "Axelar", IsDefault: false},
|
{Ticker: "AXL", Name: "Axelar", IsDefault: false},
|
||||||
}
|
}
|
||||||
|
|
||||||
templ InputCoinSelect() {
|
templ CoinSelect() {
|
||||||
<sl-select
|
<sl-select
|
||||||
label="Accounts"
|
label="Accounts"
|
||||||
name="selected_assets"
|
name="selected_assets"
|
@ -1,7 +1,7 @@
|
|||||||
// Code generated by templ - DO NOT EDIT.
|
// Code generated by templ - DO NOT EDIT.
|
||||||
|
|
||||||
// templ: version: v0.2.793
|
// templ: version: v0.2.793
|
||||||
package form
|
package input
|
||||||
|
|
||||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ var defaultCoins = []Coin{
|
|||||||
{Ticker: "AXL", Name: "Axelar", IsDefault: false},
|
{Ticker: "AXL", Name: "Axelar", IsDefault: false},
|
||||||
}
|
}
|
||||||
|
|
||||||
func InputCoinSelect() templ.Component {
|
func CoinSelect() templ.Component {
|
||||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||||
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
||||||
@ -99,7 +99,7 @@ func CoinOption(a Coin) templ.Component {
|
|||||||
var templ_7745c5c3_Var3 string
|
var templ_7745c5c3_Var3 string
|
||||||
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(a.Ticker)
|
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(a.Ticker)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/nebula/form/input_coin_select.templ`, Line: 58, Col: 29}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/nebula/input/coin_select.templ`, Line: 58, Col: 29}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
@ -112,7 +112,7 @@ func CoinOption(a Coin) templ.Component {
|
|||||||
var templ_7745c5c3_Var4 string
|
var templ_7745c5c3_Var4 string
|
||||||
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(a.Ticker)
|
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(a.Ticker)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/nebula/form/input_coin_select.templ`, Line: 59, Col: 41}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/nebula/input/coin_select.templ`, Line: 59, Col: 41}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
@ -125,7 +125,7 @@ func CoinOption(a Coin) templ.Component {
|
|||||||
var templ_7745c5c3_Var5 string
|
var templ_7745c5c3_Var5 string
|
||||||
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(a.Name)
|
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(a.Name)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/nebula/form/input_coin_select.templ`, Line: 60, Col: 11}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/nebula/input/coin_select.templ`, Line: 60, Col: 11}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
@ -143,7 +143,7 @@ func CoinOption(a Coin) templ.Component {
|
|||||||
var templ_7745c5c3_Var6 string
|
var templ_7745c5c3_Var6 string
|
||||||
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(a.Ticker)
|
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(a.Ticker)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/nebula/form/input_coin_select.templ`, Line: 64, Col: 29}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/nebula/input/coin_select.templ`, Line: 64, Col: 29}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
@ -156,7 +156,7 @@ func CoinOption(a Coin) templ.Component {
|
|||||||
var templ_7745c5c3_Var7 string
|
var templ_7745c5c3_Var7 string
|
||||||
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(a.Ticker)
|
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(a.Ticker)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/nebula/form/input_coin_select.templ`, Line: 65, Col: 41}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/nebula/input/coin_select.templ`, Line: 65, Col: 41}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
@ -169,7 +169,7 @@ func CoinOption(a Coin) templ.Component {
|
|||||||
var templ_7745c5c3_Var8 string
|
var templ_7745c5c3_Var8 string
|
||||||
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(a.Name)
|
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(a.Name)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/nebula/form/input_coin_select.templ`, Line: 66, Col: 11}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/nebula/input/coin_select.templ`, Line: 66, Col: 11}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
@ -1,18 +1,18 @@
|
|||||||
package form
|
package input
|
||||||
|
|
||||||
type InputHandleState string
|
type HandleState string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
InputHandleStateInitial InputHandleState = "inital"
|
HandleStateInitial HandleState = "inital"
|
||||||
InputHandleStateValid InputHandleState = "valid"
|
HandleStateValid HandleState = "valid"
|
||||||
InputHandleStateInvalid InputHandleState = "invalid"
|
HandleStateInvalid HandleState = "invalid"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (s InputHandleState) string() string {
|
func (s HandleState) string() string {
|
||||||
return string(s)
|
return string(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
templ InputHandle() {
|
templ Handle() {
|
||||||
<sl-input name="handle" placeholder="digitalgold" type="text" label="Handle" minlength="4" maxlength="12" required>
|
<sl-input name="handle" placeholder="digitalgold" type="text" label="Handle" minlength="4" maxlength="12" required>
|
||||||
<div slot="prefix">
|
<div slot="prefix">
|
||||||
<sl-icon name="at-sign" library="sonr"></sl-icon>
|
<sl-icon name="at-sign" library="sonr"></sl-icon>
|
||||||
@ -21,7 +21,7 @@ templ InputHandle() {
|
|||||||
<br/>
|
<br/>
|
||||||
}
|
}
|
||||||
|
|
||||||
templ InputHandleError() {
|
templ HandleError() {
|
||||||
<sl-input name="handle" placeholder="digitalgold" type="text" label="Handle" minlength="4" maxlength="12" required class="border-red-500">
|
<sl-input name="handle" placeholder="digitalgold" type="text" label="Handle" minlength="4" maxlength="12" required class="border-red-500">
|
||||||
<div slot="prefix">
|
<div slot="prefix">
|
||||||
<sl-icon name="at-sign" library="sonr"></sl-icon>
|
<sl-icon name="at-sign" library="sonr"></sl-icon>
|
||||||
@ -33,7 +33,7 @@ templ InputHandleError() {
|
|||||||
<br/>
|
<br/>
|
||||||
}
|
}
|
||||||
|
|
||||||
templ InputHandleValid() {
|
templ HandleValid() {
|
||||||
<sl-input name="handle" placeholder="digitalgold" type="text" label="Handle" minlength="4" maxlength="12" required class="border-green-500">
|
<sl-input name="handle" placeholder="digitalgold" type="text" label="Handle" minlength="4" maxlength="12" required class="border-green-500">
|
||||||
<div slot="prefix" style="color: #46A758;">
|
<div slot="prefix" style="color: #46A758;">
|
||||||
<sl-icon name="at-sign" library="sonr"></sl-icon>
|
<sl-icon name="at-sign" library="sonr"></sl-icon>
|
@ -1,26 +1,26 @@
|
|||||||
// Code generated by templ - DO NOT EDIT.
|
// Code generated by templ - DO NOT EDIT.
|
||||||
|
|
||||||
// templ: version: v0.2.793
|
// templ: version: v0.2.793
|
||||||
package form
|
package input
|
||||||
|
|
||||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||||
|
|
||||||
import "github.com/a-h/templ"
|
import "github.com/a-h/templ"
|
||||||
import templruntime "github.com/a-h/templ/runtime"
|
import templruntime "github.com/a-h/templ/runtime"
|
||||||
|
|
||||||
type InputHandleState string
|
type HandleState string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
InputHandleStateInitial InputHandleState = "inital"
|
HandleStateInitial HandleState = "inital"
|
||||||
InputHandleStateValid InputHandleState = "valid"
|
HandleStateValid HandleState = "valid"
|
||||||
InputHandleStateInvalid InputHandleState = "invalid"
|
HandleStateInvalid HandleState = "invalid"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (s InputHandleState) string() string {
|
func (s HandleState) string() string {
|
||||||
return string(s)
|
return string(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
func InputHandle() templ.Component {
|
func Handle() templ.Component {
|
||||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||||
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
||||||
@ -41,7 +41,7 @@ func InputHandle() templ.Component {
|
|||||||
templ_7745c5c3_Var1 = templ.NopComponent
|
templ_7745c5c3_Var1 = templ.NopComponent
|
||||||
}
|
}
|
||||||
ctx = templ.ClearChildren(ctx)
|
ctx = templ.ClearChildren(ctx)
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<sl-input name=\"handle\" placeholder=\"digitalgold\" type=\"text\" label=\"Handle\" minlength=\"4\" maxlength=\"12\" required><div slot=\"prefix\"><sl-icon name=\"at-sign\" library=\"sonr\"></sl-icon></div></sl-input>")
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<sl-input name=\"handle\" placeholder=\"digitalgold\" type=\"text\" label=\"Handle\" minlength=\"4\" maxlength=\"12\" required><div slot=\"prefix\"><sl-icon name=\"at-sign\" library=\"sonr\"></sl-icon></div></sl-input><br>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@ -49,7 +49,7 @@ func InputHandle() templ.Component {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func InputHandleError() templ.Component {
|
func HandleError() templ.Component {
|
||||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||||
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
||||||
@ -70,7 +70,7 @@ func InputHandleError() templ.Component {
|
|||||||
templ_7745c5c3_Var2 = templ.NopComponent
|
templ_7745c5c3_Var2 = templ.NopComponent
|
||||||
}
|
}
|
||||||
ctx = templ.ClearChildren(ctx)
|
ctx = templ.ClearChildren(ctx)
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<sl-input name=\"handle\" placeholder=\"digitalgold\" type=\"text\" label=\"Handle\" minlength=\"4\" maxlength=\"12\" required class=\"border-red-500\"><div slot=\"prefix\"><sl-icon name=\"at-sign\" library=\"sonr\"></sl-icon></div><div slot=\"suffix\" style=\"color: #B54549;\"><sl-icon name=\"at-sign\" library=\"sonr\"></sl-icon></div></sl-input>")
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<sl-input name=\"handle\" placeholder=\"digitalgold\" type=\"text\" label=\"Handle\" minlength=\"4\" maxlength=\"12\" required class=\"border-red-500\"><div slot=\"prefix\"><sl-icon name=\"at-sign\" library=\"sonr\"></sl-icon></div><div slot=\"suffix\" style=\"color: #B54549;\"><sl-icon name=\"at-sign\" library=\"sonr\"></sl-icon></div></sl-input><br>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@ -78,7 +78,7 @@ func InputHandleError() templ.Component {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func InputHandleValid() templ.Component {
|
func HandleValid() templ.Component {
|
||||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||||
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
||||||
@ -99,7 +99,7 @@ func InputHandleValid() templ.Component {
|
|||||||
templ_7745c5c3_Var3 = templ.NopComponent
|
templ_7745c5c3_Var3 = templ.NopComponent
|
||||||
}
|
}
|
||||||
ctx = templ.ClearChildren(ctx)
|
ctx = templ.ClearChildren(ctx)
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<sl-input name=\"handle\" placeholder=\"digitalgold\" type=\"text\" label=\"Handle\" minlength=\"4\" maxlength=\"12\" required class=\"border-green-500\"><div slot=\"prefix\" style=\"color: #46A758;\"><sl-icon name=\"at-sign\" library=\"sonr\"></sl-icon></div></sl-input>")
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<sl-input name=\"handle\" placeholder=\"digitalgold\" type=\"text\" label=\"Handle\" minlength=\"4\" maxlength=\"12\" required class=\"border-green-500\"><div slot=\"prefix\" style=\"color: #46A758;\"><sl-icon name=\"at-sign\" library=\"sonr\"></sl-icon></div></sl-input><br>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
@ -1,18 +1,18 @@
|
|||||||
package form
|
package input
|
||||||
|
|
||||||
type InputNameState string
|
type NameState string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
InputNameStateInitial InputNameState = "inital"
|
NameStateInitial NameState = "inital"
|
||||||
InputNameStateValid InputNameState = "valid"
|
NameStateValid NameState = "valid"
|
||||||
InputNameStateInvalid InputNameState = "invalid"
|
NameStateInvalid NameState = "invalid"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (s InputNameState) string() string {
|
func (s NameState) string() string {
|
||||||
return string(s)
|
return string(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
templ InputName() {
|
templ Name() {
|
||||||
<div hx-target="this" hx-swap="outerHTML" class="grid grid-cols-1 lg:grid-cols-2 gap-4">
|
<div hx-target="this" hx-swap="outerHTML" class="grid grid-cols-1 lg:grid-cols-2 gap-4">
|
||||||
<sl-input name="first_name" placeholder="Satoshi" type="text" label="First Name" required autofocus></sl-input>
|
<sl-input name="first_name" placeholder="Satoshi" type="text" label="First Name" required autofocus></sl-input>
|
||||||
<sl-input name="last_name" placeholder="N" maxlength="1" type="text" label="Last Initial"></sl-input>
|
<sl-input name="last_name" placeholder="N" maxlength="1" type="text" label="Last Initial"></sl-input>
|
||||||
@ -20,7 +20,7 @@ templ InputName() {
|
|||||||
<br/>
|
<br/>
|
||||||
}
|
}
|
||||||
|
|
||||||
templ InputNameError() {
|
templ NameError() {
|
||||||
<div class="grid grid-cols-1 lg:grid-cols-2 gap-4">
|
<div class="grid grid-cols-1 lg:grid-cols-2 gap-4">
|
||||||
<sl-input name="first_name" placeholder="Satoshi" type="text" label="First Name" required autofocus class="border-red-500"></sl-input>
|
<sl-input name="first_name" placeholder="Satoshi" type="text" label="First Name" required autofocus class="border-red-500"></sl-input>
|
||||||
<sl-input name="last_name" placeholder="N" maxlength="1" type="text" label="Last Initial" class="border-red-500"></sl-input>
|
<sl-input name="last_name" placeholder="N" maxlength="1" type="text" label="Last Initial" class="border-red-500"></sl-input>
|
||||||
@ -28,7 +28,7 @@ templ InputNameError() {
|
|||||||
<br/>
|
<br/>
|
||||||
}
|
}
|
||||||
|
|
||||||
templ InputNameValid() {
|
templ NameValid() {
|
||||||
<div class="grid grid-cols-1 lg:grid-cols-2 gap-4">
|
<div class="grid grid-cols-1 lg:grid-cols-2 gap-4">
|
||||||
<sl-input name="first_name" placeholder="Satoshi" type="text" label="First Name" required autofocus class="border-green-500"></sl-input>
|
<sl-input name="first_name" placeholder="Satoshi" type="text" label="First Name" required autofocus class="border-green-500"></sl-input>
|
||||||
<sl-input name="last_name" placeholder="N" maxlength="1" type="text" label="Last Initial" class="border-green-500"></sl-input>
|
<sl-input name="last_name" placeholder="N" maxlength="1" type="text" label="Last Initial" class="border-green-500"></sl-input>
|
@ -1,26 +1,26 @@
|
|||||||
// Code generated by templ - DO NOT EDIT.
|
// Code generated by templ - DO NOT EDIT.
|
||||||
|
|
||||||
// templ: version: v0.2.793
|
// templ: version: v0.2.793
|
||||||
package form
|
package input
|
||||||
|
|
||||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||||
|
|
||||||
import "github.com/a-h/templ"
|
import "github.com/a-h/templ"
|
||||||
import templruntime "github.com/a-h/templ/runtime"
|
import templruntime "github.com/a-h/templ/runtime"
|
||||||
|
|
||||||
type InputNameState string
|
type NameState string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
InputNameStateInitial InputNameState = "inital"
|
NameStateInitial NameState = "inital"
|
||||||
InputNameStateValid InputNameState = "valid"
|
NameStateValid NameState = "valid"
|
||||||
InputNameStateInvalid InputNameState = "invalid"
|
NameStateInvalid NameState = "invalid"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (s InputNameState) string() string {
|
func (s NameState) string() string {
|
||||||
return string(s)
|
return string(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
func InputName() templ.Component {
|
func Name() templ.Component {
|
||||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||||
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
||||||
@ -41,7 +41,7 @@ func InputName() templ.Component {
|
|||||||
templ_7745c5c3_Var1 = templ.NopComponent
|
templ_7745c5c3_Var1 = templ.NopComponent
|
||||||
}
|
}
|
||||||
ctx = templ.ClearChildren(ctx)
|
ctx = templ.ClearChildren(ctx)
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div hx-target=\"this\" hx-swap=\"outerHTML\" class=\"grid grid-cols-1 lg:grid-cols-2 gap-4\"><sl-input name=\"first_name\" placeholder=\"Satoshi\" type=\"text\" label=\"First Name\" required autofocus></sl-input> <sl-input name=\"last_name\" placeholder=\"N\" maxlength=\"1\" type=\"text\" label=\"Last Initial\"></sl-input></div>")
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div hx-target=\"this\" hx-swap=\"outerHTML\" class=\"grid grid-cols-1 lg:grid-cols-2 gap-4\"><sl-input name=\"first_name\" placeholder=\"Satoshi\" type=\"text\" label=\"First Name\" required autofocus></sl-input> <sl-input name=\"last_name\" placeholder=\"N\" maxlength=\"1\" type=\"text\" label=\"Last Initial\"></sl-input></div><br>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@ -49,7 +49,7 @@ func InputName() templ.Component {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func InputNameError() templ.Component {
|
func NameError() templ.Component {
|
||||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||||
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
||||||
@ -70,7 +70,7 @@ func InputNameError() templ.Component {
|
|||||||
templ_7745c5c3_Var2 = templ.NopComponent
|
templ_7745c5c3_Var2 = templ.NopComponent
|
||||||
}
|
}
|
||||||
ctx = templ.ClearChildren(ctx)
|
ctx = templ.ClearChildren(ctx)
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"grid grid-cols-1 lg:grid-cols-2 gap-4\"><sl-input name=\"first_name\" placeholder=\"Satoshi\" type=\"text\" label=\"First Name\" required autofocus class=\"border-red-500\"></sl-input> <sl-input name=\"last_name\" placeholder=\"N\" maxlength=\"1\" type=\"text\" label=\"Last Initial\" class=\"border-red-500\"></sl-input></div>")
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"grid grid-cols-1 lg:grid-cols-2 gap-4\"><sl-input name=\"first_name\" placeholder=\"Satoshi\" type=\"text\" label=\"First Name\" required autofocus class=\"border-red-500\"></sl-input> <sl-input name=\"last_name\" placeholder=\"N\" maxlength=\"1\" type=\"text\" label=\"Last Initial\" class=\"border-red-500\"></sl-input></div><br>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@ -78,7 +78,7 @@ func InputNameError() templ.Component {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func InputNameValid() templ.Component {
|
func NameValid() templ.Component {
|
||||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||||
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
||||||
@ -99,7 +99,7 @@ func InputNameValid() templ.Component {
|
|||||||
templ_7745c5c3_Var3 = templ.NopComponent
|
templ_7745c5c3_Var3 = templ.NopComponent
|
||||||
}
|
}
|
||||||
ctx = templ.ClearChildren(ctx)
|
ctx = templ.ClearChildren(ctx)
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"grid grid-cols-1 lg:grid-cols-2 gap-4\"><sl-input name=\"first_name\" placeholder=\"Satoshi\" type=\"text\" label=\"First Name\" required autofocus class=\"border-green-500\"></sl-input> <sl-input name=\"last_name\" placeholder=\"N\" maxlength=\"1\" type=\"text\" label=\"Last Initial\" class=\"border-green-500\"></sl-input></div>")
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"grid grid-cols-1 lg:grid-cols-2 gap-4\"><sl-input name=\"first_name\" placeholder=\"Satoshi\" type=\"text\" label=\"First Name\" required autofocus class=\"border-green-500\"></sl-input> <sl-input name=\"last_name\" placeholder=\"N\" maxlength=\"1\" type=\"text\" label=\"Last Initial\" class=\"border-green-500\"></sl-input></div><br>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
@ -1,6 +1,6 @@
|
|||||||
package form
|
package input
|
||||||
|
|
||||||
templ InputPasskey(addr string, userHandle string, challenge string) {
|
templ Passkey(addr string, userHandle string, challenge string) {
|
||||||
<sl-button style="width: 100%;" onclick={ navigatorCredentialsCreate(addr, userHandle, challenge) }>
|
<sl-button style="width: 100%;" onclick={ navigatorCredentialsCreate(addr, userHandle, challenge) }>
|
||||||
<sl-icon slot="prefix" name="passkey" library="sonr" style="font-size: 24px;" class="text-neutral-500"></sl-icon>
|
<sl-icon slot="prefix" name="passkey" library="sonr" style="font-size: 24px;" class="text-neutral-500"></sl-icon>
|
||||||
Register Passkey
|
Register Passkey
|
||||||
@ -88,7 +88,7 @@ navigator.credentials
|
|||||||
form.submit();
|
form.submit();
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.error('InputPasskey creation failed:', err);
|
console.error('Passkey creation failed:', err);
|
||||||
alert(`Failed to create passkey: ${err.message || 'Unknown error'}`);
|
alert(`Failed to create passkey: ${err.message || 'Unknown error'}`);
|
||||||
});
|
});
|
||||||
}
|
}
|
@ -1,14 +1,14 @@
|
|||||||
// Code generated by templ - DO NOT EDIT.
|
// Code generated by templ - DO NOT EDIT.
|
||||||
|
|
||||||
// templ: version: v0.2.793
|
// templ: version: v0.2.793
|
||||||
package form
|
package input
|
||||||
|
|
||||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||||
|
|
||||||
import "github.com/a-h/templ"
|
import "github.com/a-h/templ"
|
||||||
import templruntime "github.com/a-h/templ/runtime"
|
import templruntime "github.com/a-h/templ/runtime"
|
||||||
|
|
||||||
func InputPasskey(addr string, userHandle string, challenge string) templ.Component {
|
func Passkey(addr string, userHandle string, challenge string) templ.Component {
|
||||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||||
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
||||||
@ -52,8 +52,8 @@ func InputPasskey(addr string, userHandle string, challenge string) templ.Compon
|
|||||||
|
|
||||||
func navigatorCredentialsCreate(userId string, userHandle string, challenge string) templ.ComponentScript {
|
func navigatorCredentialsCreate(userId string, userHandle string, challenge string) templ.ComponentScript {
|
||||||
return templ.ComponentScript{
|
return templ.ComponentScript{
|
||||||
Name: `__templ_navigatorCredentialsCreate_7c0a`,
|
Name: `__templ_navigatorCredentialsCreate_7340`,
|
||||||
Function: `function __templ_navigatorCredentialsCreate_7c0a(userId, userHandle, challenge){const publicKey = {
|
Function: `function __templ_navigatorCredentialsCreate_7340(userId, userHandle, challenge){const publicKey = {
|
||||||
challenge: Uint8Array.from(challenge, (c) => c.charCodeAt(0)),
|
challenge: Uint8Array.from(challenge, (c) => c.charCodeAt(0)),
|
||||||
rp: {
|
rp: {
|
||||||
name: "Sonr.ID",
|
name: "Sonr.ID",
|
||||||
@ -133,12 +133,12 @@ navigator.credentials
|
|||||||
form.submit();
|
form.submit();
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.error('InputPasskey creation failed:', err);
|
console.error('Passkey creation failed:', err);
|
||||||
alert(` + "`" + `Failed to create passkey: ${err.message || 'Unknown error'}` + "`" + `);
|
alert(` + "`" + `Failed to create passkey: ${err.message || 'Unknown error'}` + "`" + `);
|
||||||
});
|
});
|
||||||
}`,
|
}`,
|
||||||
Call: templ.SafeScript(`__templ_navigatorCredentialsCreate_7c0a`, userId, userHandle, challenge),
|
Call: templ.SafeScript(`__templ_navigatorCredentialsCreate_7340`, userId, userHandle, challenge),
|
||||||
CallInline: templ.SafeScriptInline(`__templ_navigatorCredentialsCreate_7c0a`, userId, userHandle, challenge),
|
CallInline: templ.SafeScriptInline(`__templ_navigatorCredentialsCreate_7340`, userId, userHandle, challenge),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,8 +1,8 @@
|
|||||||
package form
|
package input
|
||||||
|
|
||||||
import "fmt"
|
import "fmt"
|
||||||
|
|
||||||
templ InputHumanSlider(firstNumber int, lastNumber int) {
|
templ HumanSlider(firstNumber int, lastNumber int) {
|
||||||
<sl-range name="is_human" label={ formatHumanSliderLabel(firstNumber, lastNumber) } help-text="Prove you are a human." min="0" max="9" step="1"></sl-range>
|
<sl-range name="is_human" label={ formatHumanSliderLabel(firstNumber, lastNumber) } help-text="Prove you are a human." min="0" max="9" step="1"></sl-range>
|
||||||
}
|
}
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
// Code generated by templ - DO NOT EDIT.
|
// Code generated by templ - DO NOT EDIT.
|
||||||
|
|
||||||
// templ: version: v0.2.793
|
// templ: version: v0.2.793
|
||||||
package form
|
package input
|
||||||
|
|
||||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||||
|
|
||||||
@ -10,7 +10,7 @@ import templruntime "github.com/a-h/templ/runtime"
|
|||||||
|
|
||||||
import "fmt"
|
import "fmt"
|
||||||
|
|
||||||
func InputHumanSlider(firstNumber int, lastNumber int) templ.Component {
|
func HumanSlider(firstNumber int, lastNumber int) templ.Component {
|
||||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||||
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
||||||
@ -38,7 +38,7 @@ func InputHumanSlider(firstNumber int, lastNumber int) templ.Component {
|
|||||||
var templ_7745c5c3_Var2 string
|
var templ_7745c5c3_Var2 string
|
||||||
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(formatHumanSliderLabel(firstNumber, lastNumber))
|
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(formatHumanSliderLabel(firstNumber, lastNumber))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/nebula/form/input_slider_isHuman.templ`, Line: 6, Col: 82}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/nebula/input/input_slider_isHuman.templ`, Line: 6, Col: 82}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
@ -24,7 +24,7 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Layout is a component that renders the general layout of the application
|
// Layout is a component that renders the general layout of the application
|
||||||
templ Root(title string) {
|
templ View(title string) {
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
@Head(title, "0.0.11")
|
@Head(title, "0.0.11")
|
||||||
|
@ -32,7 +32,7 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Layout is a component that renders the general layout of the application
|
// Layout is a component that renders the general layout of the application
|
||||||
func Root(title string) templ.Component {
|
func View(title string) templ.Component {
|
||||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||||
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user