Initial commit: add .gitignore and README
Some checks failed
CI / lint-and-test (push) Has been cancelled
Some checks failed
CI / lint-and-test (push) Has been cancelled
This commit is contained in:
17
shared/package.json
Normal file
17
shared/package.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "@solace/shared",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"main": "./src/index.ts",
|
||||
"types": "./src/index.ts",
|
||||
"scripts": {
|
||||
"type-check": "tsc --noEmit"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^5.3.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"zod": "^3.22.4"
|
||||
}
|
||||
}
|
||||
|
||||
2
shared/src/index.ts
Normal file
2
shared/src/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from "./types";
|
||||
|
||||
45
shared/src/types.ts
Normal file
45
shared/src/types.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import { z } from "zod";
|
||||
|
||||
export const AddressSchema = z.string().regex(/^0x[a-fA-F0-9]{40}$/);
|
||||
export type Address = z.infer<typeof AddressSchema>;
|
||||
|
||||
export const TreasurySchema = z.object({
|
||||
id: z.string().uuid(),
|
||||
organizationId: z.string().uuid(),
|
||||
chainId: z.number(),
|
||||
mainWallet: AddressSchema,
|
||||
label: z.string().optional(),
|
||||
createdAt: z.date(),
|
||||
updatedAt: z.date(),
|
||||
});
|
||||
|
||||
export type Treasury = z.infer<typeof TreasurySchema>;
|
||||
|
||||
export const SubAccountSchema = z.object({
|
||||
id: z.string().uuid(),
|
||||
treasuryId: z.string().uuid(),
|
||||
address: AddressSchema,
|
||||
label: z.string().optional(),
|
||||
metadataHash: z.string().optional(),
|
||||
createdAt: z.date(),
|
||||
});
|
||||
|
||||
export type SubAccount = z.infer<typeof SubAccountSchema>;
|
||||
|
||||
export const TransactionProposalSchema = z.object({
|
||||
id: z.string().uuid(),
|
||||
treasuryId: z.string().uuid(),
|
||||
proposalId: z.number(),
|
||||
walletAddress: AddressSchema,
|
||||
to: AddressSchema,
|
||||
value: z.string(), // BigInt as string
|
||||
token: AddressSchema.optional(),
|
||||
data: z.string().optional(),
|
||||
status: z.enum(["pending", "executed", "rejected"]),
|
||||
proposer: AddressSchema,
|
||||
createdAt: z.date(),
|
||||
executedAt: z.date().optional(),
|
||||
});
|
||||
|
||||
export type TransactionProposal = z.infer<typeof TransactionProposalSchema>;
|
||||
|
||||
19
shared/tsconfig.json
Normal file
19
shared/tsconfig.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2020",
|
||||
"module": "commonjs",
|
||||
"lib": ["ES2020"],
|
||||
"declaration": true,
|
||||
"outDir": "./dist",
|
||||
"rootDir": "./src",
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"resolveJsonModule": true,
|
||||
"moduleResolution": "node"
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user