Skip to content

Commit

Permalink
from last weekend
Browse files Browse the repository at this point in the history
  • Loading branch information
0xFlicker committed Aug 25, 2023
1 parent 8e4875c commit 82435d6
Show file tree
Hide file tree
Showing 29 changed files with 892 additions and 119 deletions.
4 changes: 2 additions & 2 deletions apps/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ yarn cli --help
Uploading all layers:

```
yarn cli bulk-mint -n testnet -o av-testnet.json {bc1p....address} '../../packages/assets/web/properties/**/*.webp'
yarn cli bulk-mint -n testnet -o av-testnet.json {bc1p....address} '../../ordinals/axolotl-valley/web/properties/**/*.webp'
```

This takes a while. Send funds to the requested address and wait. At the end you get a av-testnet.json that maps all file paths to ordinal IDs.
Expand All @@ -23,7 +23,7 @@ The file was copied and turned into [ordinals/axolotl-valley/src/inscriptions/te
Creating the javascript:

```
yarn cli axolotl-valley script --network testnet script.js
yarn cli axolotl-valley script --network testnet script.js
```

Inscribe the javascript:
Expand Down
15 changes: 7 additions & 8 deletions apps/cli/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ type Mutation {

type Query {
inscriptionTransaction(id: ID!): InscriptionTransaction
inscriptionFunding(id: ID!): InscriptionFunding

userByAddress(address: ID!): Web3User!
}
Expand Down Expand Up @@ -159,6 +158,10 @@ type InscriptionFunding {
inscriptionContent(tapKey: String!): InscriptionData!
}

type Query {
inscriptionFunding(id: ID!): InscriptionFunding
}

type KeyValue {
key: String!
value: String!
Expand All @@ -181,6 +184,7 @@ type Collection {
input CollectionInput {
name: String!
maxSupply: Int!
meta: String
}

type Mutation {
Expand Down Expand Up @@ -211,9 +215,7 @@ type BitcoinScriptItem {
}

input AxolotlRequest {
destinationAddress: String!
request: String
proof: String
claimingAddress: String!
network: BitcoinNetwork!
feeLevel: FeeLevel
feePerByte: Int
Expand All @@ -224,9 +226,6 @@ type AxolotlFunding {
id: ID!
inscriptionFunding: InscriptionFunding

request: String
proof: String

tokenId: Int!
createdAt: String!
originAddress: String!
Expand All @@ -242,7 +241,7 @@ type AxolotlFundingPage {

type Mutation {
requestFundingAddress(request: InscriptionRequest!): InscriptionFunding!
axolotlFundingAddressRequest(request: AxolotlRequest!): AxolotlFunding!
axolotlFundingAddressRequest(request: AxolotlRequest!): [AxolotlFunding!]!
}

type Mutation {
Expand Down
49 changes: 47 additions & 2 deletions apps/cli/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { bulkMint } from "./commands/bulkMint.js";
import { mintSingle } from "./commands/mintSingle.js";
import { nonceBitcoin, nonceEthereum } from "./commands/login/nonce.js";
import { siwe } from "./commands/login/siwe.js";
import { collectionCreate } from "./commands/collection/create.js";
const program = new Command();

program
Expand Down Expand Up @@ -103,7 +104,7 @@ apiCommand
}
return value;
},
"bitcoin",
"bitcoin"
)
.option("-c, --chain-id <chain-id>", "Ethereum chain id", Number, 1)
.action(async (address, props) => {
Expand All @@ -120,10 +121,54 @@ apiCommand
.option("-u, --url <url>", "api url", "http://localhost:4000")
.option("-c, --chain-id <chain-id>", "Ethereum chain id", Number, 1)
.action(async ({ url, chainId }) => {
await siwe({
const token = await siwe({
chainId,
url,
});
console.log(`Token: ${token}`);
});

const collectionCommand = program.command("collection");

collectionCommand
.command("create <name> <maxSupply>")
.option("-u, --url <url>", "api url", "http://localhost:4000")
.option(
"-m, --metadata <metadata>",
"metadata in key=value format. can be used multiple times"
)
.option("-s, --swie-login <chainid>", "login to the api")
.option("-d, --doc <doc>", "key=path format. load a file as the metadata")
.action(async (name, maxSupply, { url, metadata, doc, swieLogin }) => {
const token = swieLogin
? await siwe({
chainId: Number(swieLogin),
url,
})
: null;
metadata = Array.isArray(metadata)
? metadata
: typeof metadata !== "undefined"
? [metadata]
: [];
if (doc) {
doc = Array.isArray(doc) ? doc : [doc];
for (const d of doc) {
const [key, docPath] = d.split("=");
const data = await fs.promises.readFile(docPath, "utf8");
metadata = metadata || [];
metadata.push(`${key}=${data}`);
}
}
await collectionCreate({
name,
maxSupply: Number(maxSupply),
url,
token,
keyValues: metadata.map((m: string) => {
const [key, value] = m.split("=");
return [key, value] as const;
}),
});
});
program.parse(process.argv);
4 changes: 3 additions & 1 deletion apps/cli/src/commands/login/siwe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ export async function siwe({ chainId, url }: { chainId: number; url: string }) {
address,
jwe,
});
console.log(`Token: ${token}`);

frame.close();

return token;
}
Loading

0 comments on commit 82435d6

Please sign in to comment.