Merge pull request #195 from cosmos/feat/use-dgraph
Use Dgraph instead of Fauna
This commit is contained in:
+2
-2
@@ -1,4 +1,4 @@
|
||||
FAUNADB_SECRET=
|
||||
FAUNADB_URL=https://graphql.eu.fauna.com/graphql
|
||||
DGRAPH_SECRET=
|
||||
DGRAPH_URL=https://nameless-brook-560056.eu-central-1.aws.cloud.dgraph.io/graphql
|
||||
NEXT_PUBLIC_MULTICHAIN=true
|
||||
NEXT_PUBLIC_REGISTRY_NAME=cosmoshub
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
FAUNADB_SECRET=
|
||||
FAUNADB_URL=https://graphql.eu.fauna.com/graphql
|
||||
DGRAPH_SECRET=
|
||||
DGRAPH_URL=https://nameless-brook-560056.eu-central-1.aws.cloud.dgraph.io/graphql
|
||||
NEXT_PUBLIC_MULTICHAIN=true
|
||||
NEXT_PUBLIC_REGISTRY_NAME=junotestnet
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# Cosmoshub Multisig App
|
||||
|
||||
This app allows for multisig users to create, sign and broadcast transactions on any stargate enabled chain. It's built with Cosmjs, Next.js, FaunaDB and Vercel.
|
||||
This app allows for multisig users to create, sign and broadcast transactions on any stargate enabled chain. It's built with Cosmjs, Next.js, Dgraph and Vercel.
|
||||
|
||||
[The app is live here](https://cosmos-multisig-ui-kohl.vercel.app/).
|
||||
[The app is live here](https://multisig.confio.run).
|
||||
|
||||
[Here is a user guide on how to use the app](https://github.com/samepant/cosmoshub-legacy-multisig/blob/master/docs/App%20User%20Guide.md)
|
||||
|
||||
@@ -16,19 +16,18 @@ This app uses Vercel for deployment and hosting, since they support next.js's se
|
||||
|
||||
### 2. Setup environment variables
|
||||
|
||||
In the Vercel control panel for your new app, go to `Settings -> Environment Variables` and add in the keys and values from this repo's `.env.sample` file. The only remaining variable should be the `FAUNADB_SECRET`, which will be available once you setup your FaunaDB instance.
|
||||
In the Vercel control panel for your new app, go to `Settings -> Environment Variables` and add in the keys and values from this repo's `.env.sample` file. The only remaining variable should be the `DGRAPH_SECRET`, which will be available once you setup your DGraph instance.
|
||||
|
||||
### 3. Initializing FaunaDB
|
||||
### 3. Initializing DGraph
|
||||
|
||||
This app relies on FaunaDB as for storing account, transaction and signature details.
|
||||
This app relies on DGraph as for storing account, transaction and signature details.
|
||||
|
||||
- Create a [FaunaDB](https://dashboard.fauna.com/) account
|
||||
- Create a new database
|
||||
- Use the "Classic" region
|
||||
- Click the "Graphql" tab, and import the `db-schema.graphql` file in the root of this repo
|
||||
- Click the "Security" tab, and create a key. Copy that key into your vercel app's environment variables as the `FAUNADB_SECRET` value
|
||||
- Create a [DGraph](https://cloud.dgraph.io) account
|
||||
- Launch a new backend
|
||||
- Click the `Develop -> Schema` menu item, and past the contents of the `db-schema.graphql` file in the root of this repo
|
||||
- Click the `Admin -> Settings` menu item, and create a key. Copy that key into your vercel app's environment variables as the `DGRAPH_SECRET` value
|
||||
|
||||
As your instance of the app is used, you can return to the FaunaDB dashboard to view records for any accounts, transactions or signatures.
|
||||
As your instance of the app is used, you can return to the DGraph dashboard to view records for any accounts, transactions or signatures.
|
||||
|
||||
### 4. Successful Deployment
|
||||
|
||||
@@ -46,17 +45,16 @@ It's recommended that you make your simapp instance mimic the denomination of co
|
||||
|
||||
A more in depth tutorial on this is coming soon :)
|
||||
|
||||
### 3. Initializing FaunaDB
|
||||
### 3. Initializing DGraph
|
||||
|
||||
This app relies on FaunaDB as for storing account, transaction and signature details.
|
||||
This app relies on DGraph as for storing account, transaction and signature details.
|
||||
|
||||
- Create a [FaunaDB](https://dashboard.fauna.com/) account
|
||||
- Create a new database
|
||||
- Use the "Europe (EU)" region
|
||||
- Click the "Graphql" tab, and import the `db-schema.graphql` file in the root of this repo
|
||||
- Click the "Security" tab, and create a key. Copy that key into the `.env.local` file for the `FAUNADB_SECRET` value
|
||||
- Create a [DGraph](https://cloud.dgraph.io) account
|
||||
- Launch a new backend
|
||||
- Click the `Develop -> Schema` menu item, and past the contents of the `db-schema.graphql` file in the root of this repo
|
||||
- Click the `Admin -> Settings` menu item, and create a key. Copy that key into your vercel app's environment variables as the `DGRAPH_SECRET` value
|
||||
|
||||
As your instance of the app is used, you can return to the FaunaDB dashboard to view records for any accounts, transactions or signatures created.
|
||||
As your instance of the app is used, you can return to the DGraph dashboard to view records for any accounts, transactions or signatures.
|
||||
|
||||
### 3. Run your instance
|
||||
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
|
||||
|
||||
export default function MigrationWarning() {
|
||||
return (
|
||||
<Alert className="mx-auto my-4 max-w-md border-yellow-300 bg-fuchsia-900">
|
||||
<AlertTitle>Warning!</AlertTitle>
|
||||
<AlertDescription className="mt-3">
|
||||
This app will no longer be available at this URL from March 1st, 2024.
|
||||
</AlertDescription>
|
||||
<AlertDescription className="mt-3">
|
||||
A new instance is deployed at{" "}
|
||||
<a href="https://multisig.confio.run" target="_blank" className="text-blue-400">
|
||||
https://multisig.confio.run
|
||||
</a>
|
||||
, connecting to a new database. You can start using this instance for new signing requests.
|
||||
Re-importing multisigs by address or public keys may be needed.
|
||||
</AlertDescription>
|
||||
<AlertDescription className="mt-3">
|
||||
Any pending transactions on this app will be lost when that time arrives. In the meantime,
|
||||
both deployments can be used but no data is shared between them.
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
);
|
||||
}
|
||||
+10
-16
@@ -1,29 +1,23 @@
|
||||
type Multisig {
|
||||
id: ID!
|
||||
# The @search annotation allows us to query the list of multisigs and filter
|
||||
# by (chainId, address) pairs. We use "hash" since we only need exact matches.
|
||||
# See https://dgraph.io/docs/graphql/schema/directives/search/#string
|
||||
chainId: String! @search(by: [hash])
|
||||
address: String! @search(by: [hash])
|
||||
pubkeyJSON: String!
|
||||
address: String!
|
||||
chainId: String!
|
||||
}
|
||||
|
||||
type SourceAddress {
|
||||
nickname: String
|
||||
address: String!
|
||||
pubkey: String!
|
||||
multisig: Multisig @relation
|
||||
}
|
||||
|
||||
type Transaction {
|
||||
signatures: [Signature] @relation
|
||||
dataJSON: String
|
||||
id: ID!
|
||||
txHash: String
|
||||
dataJSON: String
|
||||
signatures: [Signature] @hasInverse(field: transaction)
|
||||
}
|
||||
|
||||
type Signature {
|
||||
transaction: Transaction! @relation
|
||||
transaction: Transaction!
|
||||
bodyBytes: String!
|
||||
signature: String!
|
||||
address: String!
|
||||
}
|
||||
|
||||
type Query {
|
||||
getMultisig(address: String!, chainId: String!): Multisig
|
||||
}
|
||||
|
||||
+86
-59
@@ -2,25 +2,28 @@ import { DbAccount, DbSignature, DbTransaction } from "../types";
|
||||
import { requestGraphQlJson } from "./request";
|
||||
|
||||
/**
|
||||
* Creates multisig record in faunadb
|
||||
* Creates multisig record in dgraph
|
||||
*
|
||||
* @param {object} multisig an object with address (string), pubkey JSON and chainId
|
||||
* @return Returns async function that makes a request to the faunadb graphql endpoint
|
||||
* @return Returns async function that makes a request to the dgraph graphql endpoint
|
||||
*/
|
||||
const createMultisig = async (multisig: DbAccount) => {
|
||||
console.log(multisig);
|
||||
return requestGraphQlJson({
|
||||
body: {
|
||||
query: `
|
||||
mutation {
|
||||
createMultisig(data: {
|
||||
address: "${multisig.address}"
|
||||
pubkeyJSON: ${JSON.stringify(multisig.pubkeyJSON)}
|
||||
chainId: "${multisig.chainId}"
|
||||
}) {
|
||||
_id
|
||||
address
|
||||
chainId
|
||||
mutation AddMultisig {
|
||||
addMultisig(
|
||||
input: {
|
||||
chainId: "${multisig.chainId}"
|
||||
address: "${multisig.address}"
|
||||
pubkeyJSON: ${JSON.stringify(multisig.pubkeyJSON)}
|
||||
}
|
||||
) {
|
||||
multisig {
|
||||
id
|
||||
chainId
|
||||
address
|
||||
}
|
||||
}
|
||||
}
|
||||
`,
|
||||
@@ -29,41 +32,62 @@ const createMultisig = async (multisig: DbAccount) => {
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets multisig pubkey from faundb
|
||||
* This is the format returned by the graphQL API.
|
||||
*
|
||||
* Keep the format in sync with `GetMultisigAccountResponse` because
|
||||
* we return the full object in the API. Right now address and chainId
|
||||
* are somewhat unnecessary to query but still nice for debgging.
|
||||
*/
|
||||
interface MultisigFromQuery {
|
||||
address: string;
|
||||
chainId: string;
|
||||
pubkeyJSON: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets multisig pubkey from DB
|
||||
*
|
||||
* @param {string} address A multisig address.
|
||||
* @param {string} chainId The chainId the multisig belongs to.
|
||||
* @return Returns async function that makes a request to the faunadb graphql endpoint
|
||||
* @return Returns async function that makes a request to the dgraph graphql endpoint
|
||||
*/
|
||||
const getMultisig = async (address: string, chainId: string) => {
|
||||
return requestGraphQlJson({
|
||||
async function getMultisig(
|
||||
address: string,
|
||||
chainId: string,
|
||||
): Promise<MultisigFromQuery | undefined> {
|
||||
const result = await requestGraphQlJson({
|
||||
body: {
|
||||
query: `
|
||||
query {
|
||||
getMultisig(address: "${address}", chainId: "${chainId}",) {
|
||||
query MultisigsByAddressAndChainId {
|
||||
queryMultisig(filter: {address: {eq: "${address}"}, chainId: {eq: "${chainId}"}}) {
|
||||
address
|
||||
pubkeyJSON
|
||||
chainId
|
||||
pubkeyJSON
|
||||
}
|
||||
}
|
||||
`,
|
||||
},
|
||||
});
|
||||
};
|
||||
const elements: [MultisigFromQuery] = result.data.queryMultisig;
|
||||
const first = elements.find(() => true);
|
||||
return first;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates transaction record in faunadb
|
||||
* Creates transaction record in dgraph
|
||||
*
|
||||
* @param {object} transaction The base transaction
|
||||
* @return Returns async function that makes a request to the faunadb graphql endpoint
|
||||
* @return Returns async function that makes a request to the dgraph graphql endpoint
|
||||
*/
|
||||
const createTransaction = async (transaction: DbTransaction) => {
|
||||
return requestGraphQlJson({
|
||||
body: {
|
||||
query: `
|
||||
mutation {
|
||||
createTransaction(data: {dataJSON: ${JSON.stringify(transaction)}}) {
|
||||
_id
|
||||
mutation AddTransaction {
|
||||
addTransaction(input: { dataJSON: ${JSON.stringify(transaction)} }) {
|
||||
transaction {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
`,
|
||||
@@ -72,26 +96,23 @@ const createTransaction = async (transaction: DbTransaction) => {
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves a transaction from faunadb
|
||||
* Retrieves a transaction from dgraph
|
||||
*
|
||||
* @param {string} id Faunadb resource id
|
||||
* @return Returns async function that makes a request to the faunadb graphql endpoint
|
||||
* @param {string} id dgraph resource id
|
||||
* @return Returns async function that makes a request to the dgraph graphql endpoint
|
||||
*/
|
||||
const findTransactionByID = async (id: string) => {
|
||||
return requestGraphQlJson({
|
||||
body: {
|
||||
query: `
|
||||
query {
|
||||
findTransactionByID(id: "${id}") {
|
||||
_id
|
||||
query GetTransaction {
|
||||
getTransaction(id: "${id}") {
|
||||
dataJSON
|
||||
txHash
|
||||
signatures {
|
||||
data {
|
||||
address
|
||||
signature
|
||||
bodyBytes
|
||||
}
|
||||
address
|
||||
signature
|
||||
bodyBytes
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -101,23 +122,25 @@ const findTransactionByID = async (id: string) => {
|
||||
};
|
||||
|
||||
/**
|
||||
* Updates txHash of transaction on FaunaDB
|
||||
* Updates txHash of transaction on dgraph
|
||||
*
|
||||
* @param {string} id Faunadb resource id
|
||||
* @param {string} id dgraph resource id
|
||||
* @param {string} txHash tx hash returned from broadcasting a tx
|
||||
* @return Returns async function that makes a request to the faunadb graphql endpoint
|
||||
* @return Returns async function that makes a request to the dgraph graphql endpoint
|
||||
*/
|
||||
const updateTxHash = async (id: string, txHash: string) => {
|
||||
return requestGraphQlJson({
|
||||
body: {
|
||||
query: `
|
||||
mutation {
|
||||
updateTransaction(id: ${id}, data: {txHash: "${txHash}"}) {
|
||||
_id
|
||||
dataJSON
|
||||
txHash
|
||||
signatures {
|
||||
data {
|
||||
mutation UpdateTransaction {
|
||||
updateTransaction(
|
||||
input: { filter: { id: "${id}" }, set: { txHash: "${txHash}" } }
|
||||
) {
|
||||
transaction {
|
||||
id
|
||||
dataJSON
|
||||
txHash
|
||||
signatures {
|
||||
address
|
||||
signature
|
||||
bodyBytes
|
||||
@@ -131,27 +154,31 @@ const updateTxHash = async (id: string, txHash: string) => {
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates signature record in faunadb
|
||||
* Creates signature record in dgraph
|
||||
*
|
||||
* @param {object} signature an object with bodyBytes (string) and signature set (Uint8 Array)
|
||||
* @param {string} transactionId id of the transaction to relate the signature with
|
||||
* @return Returns async function that makes a request to the faunadb graphql endpoint
|
||||
* @return Returns async function that makes a request to the dgraph graphql endpoint
|
||||
*/
|
||||
const createSignature = async (signature: DbSignature, transactionId: string) => {
|
||||
return requestGraphQlJson({
|
||||
body: {
|
||||
query: `
|
||||
mutation {
|
||||
createSignature(data: {
|
||||
transaction: {connect: ${transactionId}},
|
||||
bodyBytes: "${signature.bodyBytes}",
|
||||
signature: "${signature.signature}",
|
||||
address: "${signature.address}"
|
||||
}) {
|
||||
_id
|
||||
address
|
||||
signature
|
||||
address
|
||||
mutation AddSignature {
|
||||
addSignature(
|
||||
input: {
|
||||
transaction: { id: "${transactionId}" }
|
||||
address: "${signature.address}"
|
||||
signature: "${signature.signature}"
|
||||
bodyBytes: "${signature.bodyBytes}"
|
||||
}
|
||||
) {
|
||||
signature {
|
||||
transaction {
|
||||
id
|
||||
}
|
||||
signature
|
||||
}
|
||||
}
|
||||
}
|
||||
`,
|
||||
|
||||
@@ -38,7 +38,7 @@ const createMultisigFromCompressedSecp256k1Pubkeys = async (
|
||||
const multisigPubkey = createMultisigThresholdPubkey(pubkeys, threshold);
|
||||
const multisigAddress = pubkeyToAddress(multisigPubkey, addressPrefix);
|
||||
|
||||
// save multisig to fauna
|
||||
// save multisig to relational offchain database
|
||||
const multisig = {
|
||||
address: multisigAddress,
|
||||
pubkeyJSON: JSON.stringify(multisigPubkey),
|
||||
@@ -73,7 +73,7 @@ const getMultisigAccount = async (
|
||||
// we need the multisig pubkeys to create transactions, if the multisig
|
||||
// is new, and has never submitted a transaction its pubkeys will not be
|
||||
// available from a node. If the multisig was created with this instance
|
||||
// of this tool its pubkey will be available in the fauna datastore
|
||||
// of this tool its pubkey will be available in the relational offchain database
|
||||
const addressError = checkAddress(address, addressPrefix);
|
||||
if (addressError) {
|
||||
throw new Error(addressError);
|
||||
|
||||
+4
-6
@@ -24,12 +24,10 @@ export const requestGhJson = (endpoint: string, { headers, ...restConfig }: Requ
|
||||
|
||||
type RequestGraphQlJsonConfig = Omit<RequestInit, "body"> & { body: { query: string } };
|
||||
|
||||
/**
|
||||
* The fallback URL works for classic databases,for more information about regions see:
|
||||
* https://docs.fauna.com/fauna/current/learn/understanding/region_groups
|
||||
*/
|
||||
export const requestGraphQlJson = (config: RequestGraphQlJsonConfig) =>
|
||||
requestJson(process.env.FAUNADB_URL || "https://graphql.fauna.com/graphql", {
|
||||
requestJson(process.env.DGRAPH_URL || "", {
|
||||
...config,
|
||||
headers: { Authorization: `Bearer ${process.env.FAUNADB_SECRET}`, ...config.headers },
|
||||
headers: process.env.DGRAPH_SECRET
|
||||
? { "X-Auth-Token": process.env.DGRAPH_SECRET, ...config.headers }
|
||||
: config.headers,
|
||||
});
|
||||
|
||||
Generated
-153
@@ -64,7 +64,6 @@
|
||||
"eslint": "8.48.0",
|
||||
"eslint-config-next": "13.4.19",
|
||||
"eslint-config-prettier": "^9.0.0",
|
||||
"faunadb": "^4.8.0",
|
||||
"jest": "^29.6.4",
|
||||
"jest-environment-jsdom": "^29.6.4",
|
||||
"lucide-react": "^0.274.0",
|
||||
@@ -4390,14 +4389,6 @@
|
||||
"url": "https://github.com/sponsors/epoberezkin"
|
||||
}
|
||||
},
|
||||
"node_modules/ansi-align": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz",
|
||||
"integrity": "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==",
|
||||
"dependencies": {
|
||||
"string-width": "^4.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/ansi-escapes": {
|
||||
"version": "4.3.2",
|
||||
"resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz",
|
||||
@@ -4869,38 +4860,6 @@
|
||||
"resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz",
|
||||
"integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ=="
|
||||
},
|
||||
"node_modules/boxen": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/boxen/-/boxen-5.1.2.tgz",
|
||||
"integrity": "sha512-9gYgQKXx+1nP8mP7CzFyaUARhg7D3n1dF/FnErWmu9l6JvGpNUN278h0aSb+QjoiKSWG+iZ3uHrcqk0qrY9RQQ==",
|
||||
"dependencies": {
|
||||
"ansi-align": "^3.0.0",
|
||||
"camelcase": "^6.2.0",
|
||||
"chalk": "^4.1.0",
|
||||
"cli-boxes": "^2.2.1",
|
||||
"string-width": "^4.2.2",
|
||||
"type-fest": "^0.20.2",
|
||||
"widest-line": "^3.1.0",
|
||||
"wrap-ansi": "^7.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/boxen/node_modules/camelcase": {
|
||||
"version": "6.3.0",
|
||||
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz",
|
||||
"integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
@@ -4965,11 +4924,6 @@
|
||||
"node-int64": "^0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/btoa-lite": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/btoa-lite/-/btoa-lite-1.0.0.tgz",
|
||||
"integrity": "sha512-gvW7InbIyF8AicrqWoptdW08pUxuhq8BEgowNajy9RhiE86fmGAGl+bLKo6oB8QP0CkqHLowfN0oJdKC/J6LbA=="
|
||||
},
|
||||
"node_modules/buffer-from": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
|
||||
@@ -5136,17 +5090,6 @@
|
||||
"resolved": "https://registry.npmjs.org/classnames/-/classnames-2.3.2.tgz",
|
||||
"integrity": "sha512-CSbhY4cFEJRe6/GQzIk5qXZ4Jeg5pcsP7b5peFSDpffpe1cqjASH/n9UTjBwOp6XpMSTwQ8Za2K5V02ueA7Tmw=="
|
||||
},
|
||||
"node_modules/cli-boxes": {
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.1.tgz",
|
||||
"integrity": "sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw==",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/client-only": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz",
|
||||
@@ -5531,14 +5474,6 @@
|
||||
"resolved": "https://registry.npmjs.org/cosmjs-types/-/cosmjs-types-0.9.0.tgz",
|
||||
"integrity": "sha512-MN/yUe6mkJwHnCFfsNPeCfXVhyxHYW6c/xDUzrSbBycYzw++XvWDMJArXp2pLdgD6FQ8DW79vkPjeNKVrXaHeQ=="
|
||||
},
|
||||
"node_modules/cross-fetch": {
|
||||
"version": "3.1.8",
|
||||
"resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.8.tgz",
|
||||
"integrity": "sha512-cvA+JwZoU0Xq+h6WkMvAUqPEYy92Obet6UdKLfW60qn99ftItKjB5T+BkyWOFWe2pUyfQ+IJHmpOTznqk1M6Kg==",
|
||||
"dependencies": {
|
||||
"node-fetch": "^2.6.12"
|
||||
}
|
||||
},
|
||||
"node_modules/cross-spawn": {
|
||||
"version": "7.0.3",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
|
||||
@@ -5943,14 +5878,6 @@
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/dotenv": {
|
||||
"version": "8.6.0",
|
||||
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.6.0.tgz",
|
||||
"integrity": "sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/electron-to-chromium": {
|
||||
"version": "1.4.510",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.510.tgz",
|
||||
@@ -6729,24 +6656,6 @@
|
||||
"reusify": "^1.0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/faunadb": {
|
||||
"version": "4.8.0",
|
||||
"resolved": "https://registry.npmjs.org/faunadb/-/faunadb-4.8.0.tgz",
|
||||
"integrity": "sha512-pjl5WUYQ8GqM4ESk3mv0RXfxtQMHWb92XWkxjf3nWiAkf2HVtsENfTbyGPunzw4zDbdhn9aQSSxbwahaLLDR7Q==",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"base64-js": "^1.2.0",
|
||||
"boxen": "^5.0.1",
|
||||
"btoa-lite": "^1.0.0",
|
||||
"chalk": "^4.1.1",
|
||||
"cross-fetch": "^3.1.5",
|
||||
"dotenv": "^8.2.0",
|
||||
"fn-annotate": "^1.1.3",
|
||||
"node-abort-controller": "^3.0.1",
|
||||
"object-assign": "^4.1.0",
|
||||
"util-deprecate": "^1.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/fb-watchman": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz",
|
||||
@@ -6815,14 +6724,6 @@
|
||||
"resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz",
|
||||
"integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ=="
|
||||
},
|
||||
"node_modules/fn-annotate": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/fn-annotate/-/fn-annotate-1.2.0.tgz",
|
||||
"integrity": "sha512-j2gv2wkRhQgkJNf1ygdca8ynP3tK+a87bowc+RG81iWTye3yKIOeAkrKYv0Kqyh8yCeSyljOk3ZFelfXUFpirA==",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/follow-redirects": {
|
||||
"version": "1.15.3",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz",
|
||||
@@ -8969,49 +8870,6 @@
|
||||
"url": "https://github.com/sponsors/colinhacks"
|
||||
}
|
||||
},
|
||||
"node_modules/node-abort-controller": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/node-abort-controller/-/node-abort-controller-3.1.1.tgz",
|
||||
"integrity": "sha512-AGK2yQKIjRuqnc6VkX2Xj5d+QW8xZ87pa1UK6yA6ouUyuxfHuMP6umE5QK7UmTeOAymo+Zx1Fxiuw9rVx8taHQ=="
|
||||
},
|
||||
"node_modules/node-fetch": {
|
||||
"version": "2.7.0",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
|
||||
"integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
|
||||
"dependencies": {
|
||||
"whatwg-url": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "4.x || >=6.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"encoding": "^0.1.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"encoding": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/node-fetch/node_modules/tr46": {
|
||||
"version": "0.0.3",
|
||||
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
|
||||
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="
|
||||
},
|
||||
"node_modules/node-fetch/node_modules/webidl-conversions": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
|
||||
"integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="
|
||||
},
|
||||
"node_modules/node-fetch/node_modules/whatwg-url": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
|
||||
"integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
|
||||
"dependencies": {
|
||||
"tr46": "~0.0.3",
|
||||
"webidl-conversions": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/node-int64": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz",
|
||||
@@ -11406,17 +11264,6 @@
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/widest-line": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz",
|
||||
"integrity": "sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg==",
|
||||
"dependencies": {
|
||||
"string-width": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/wrap-ansi": {
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
|
||||
|
||||
@@ -69,7 +69,6 @@
|
||||
"eslint": "8.48.0",
|
||||
"eslint-config-next": "13.4.19",
|
||||
"eslint-config-prettier": "^9.0.0",
|
||||
"faunadb": "^4.8.0",
|
||||
"jest": "^29.6.4",
|
||||
"jest-environment-jsdom": "^29.6.4",
|
||||
"lucide-react": "^0.274.0",
|
||||
|
||||
@@ -40,9 +40,9 @@ export const getServerSideProps: GetServerSideProps = async (context): Promise<P
|
||||
console.log("Function `findTransactionByID` invoked", transactionID);
|
||||
const getRes = await findTransactionByID(transactionID);
|
||||
console.log("success", getRes.data);
|
||||
txHash = getRes.data.findTransactionByID.txHash;
|
||||
transactionJSON = getRes.data.findTransactionByID.dataJSON;
|
||||
signatures = getRes.data.findTransactionByID.signatures.data || [];
|
||||
txHash = getRes.data.getTransaction.txHash;
|
||||
transactionJSON = getRes.data.getTransaction.dataJSON;
|
||||
signatures = getRes.data.getTransaction.signatures;
|
||||
} catch (err: unknown) {
|
||||
console.log(err);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import Header from "@/components/Header";
|
||||
import MigrationWarning from "@/components/MigrationWarning";
|
||||
import { Toaster } from "@/components/ui/toaster";
|
||||
import { TooltipProvider } from "@/components/ui/tooltip";
|
||||
import ThemeProvider from "@/context/ThemesContext";
|
||||
@@ -13,7 +12,6 @@ export default function MultisigApp({ Component, pageProps }: AppProps) {
|
||||
<ThemeProvider attribute="class" defaultTheme="dark" enableSystem>
|
||||
<TooltipProvider>
|
||||
<Header />
|
||||
<MigrationWarning />
|
||||
<Component {...pageProps} />
|
||||
<Toaster />
|
||||
</TooltipProvider>
|
||||
|
||||
@@ -8,13 +8,13 @@ export default async function multisigAddressApi(req: NextApiRequest, res: NextA
|
||||
const multisigAddress = req.query.multisigAddress?.toString() || "";
|
||||
const chainId = req.query.chainId?.toString() || "";
|
||||
console.log("Function `getMultisig` invoked", multisigAddress, chainId);
|
||||
const getRes = await getMultisig(multisigAddress, chainId);
|
||||
if (!getRes.data.getMultisig) {
|
||||
const multisig = await getMultisig(multisigAddress, chainId);
|
||||
if (!multisig) {
|
||||
res.status(404).send("Multisig not found");
|
||||
return;
|
||||
}
|
||||
console.log("success", getRes.data.getMultisig);
|
||||
res.status(200).send(getRes.data.getMultisig);
|
||||
console.log("success", multisig);
|
||||
res.status(200).send(multisig);
|
||||
return;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} catch (err: any) {
|
||||
|
||||
@@ -8,8 +8,8 @@ export default async function multisigApi(req: NextApiRequest, res: NextApiRespo
|
||||
const data = req.body;
|
||||
console.log("Function `createMultisig` invoked", data);
|
||||
const saveRes = await createMultisig(data);
|
||||
console.log("success", saveRes.data);
|
||||
res.status(200).send(saveRes.data.createMultisig);
|
||||
console.log("success", saveRes);
|
||||
res.status(200).send(saveRes.data.addMultisig.multisig[0]);
|
||||
return;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} catch (err: any) {
|
||||
|
||||
@@ -10,7 +10,7 @@ export default async function transactionIDApi(req: NextApiRequest, res: NextApi
|
||||
console.log("Function `updateTransaction` invoked", txHash);
|
||||
const saveRes = await updateTxHash(transactionID, txHash);
|
||||
console.log("success", saveRes.data);
|
||||
res.status(200).send(saveRes.data.updateTransaction);
|
||||
res.status(200).send(saveRes.data.updateTransaction.transaction[0]);
|
||||
return;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} catch (err: any) {
|
||||
|
||||
@@ -10,7 +10,7 @@ export default async function transactionIDApi(req: NextApiRequest, res: NextApi
|
||||
console.log("Function `createSignature` invoked", data);
|
||||
const saveRes = await createSignature(data, transactionID);
|
||||
console.log("success", saveRes.data);
|
||||
res.status(200).send(saveRes.data.createSignature);
|
||||
res.status(200).send(saveRes.data.addSignature.signature[0]);
|
||||
return;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} catch (err: any) {
|
||||
|
||||
@@ -9,7 +9,9 @@ export default async function transactionApi(req: NextApiRequest, res: NextApiRe
|
||||
console.log("Function `createTransaction` invoked", data);
|
||||
const createTransactionResult = await createTransaction(data.dataJSON);
|
||||
console.log("createTransactionResult:", createTransactionResult);
|
||||
res.status(200).send({ transactionID: createTransactionResult.data.createTransaction._id });
|
||||
res
|
||||
.status(200)
|
||||
.send({ transactionID: createTransactionResult.data.addTransaction.transaction[0].id });
|
||||
return;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} catch (err: any) {
|
||||
|
||||
Reference in New Issue
Block a user