@midcontract/protocol
Advanced tools
Comparing version 1.0.0-rc.26 to 1.0.0-rc.27
// Generated by dts-bundle-generator v9.3.1 | ||
import { Account, Address, Chain, CustomTransport, EIP1193Provider, Hash, HttpTransport } from 'viem'; | ||
import { Abi, Account, Address, Chain, CustomTransport, EIP1193Provider, Hash, HttpTransport } from 'viem'; | ||
import { Transaction, TransactionReceipt } from 'viem/types/transaction'; | ||
@@ -9,3 +9,3 @@ | ||
}; | ||
export type Environment = "prod" | "beta" | "test" | "local"; | ||
export type Environment = "prod" | "beta" | "beta2" | "test" | "local"; | ||
export type SymbolToken = "USDT" | "USDC" | "MockUSDT"; | ||
@@ -21,3 +21,3 @@ export type DataToken = { | ||
escrow: { | ||
[key: string]: Address; | ||
[key: string]: Address | Abi; | ||
}; | ||
@@ -113,2 +113,16 @@ tokenList: TokenList; | ||
} | ||
export interface ApproveInputMilestone { | ||
contractId: bigint; | ||
milestoneId: bigint; | ||
valueApprove: number; | ||
recipient: Address; | ||
token: SymbolToken; | ||
} | ||
export interface ApproveInputHourly { | ||
contractId: bigint; | ||
weekId: bigint; | ||
valueApprove: number; | ||
recipient: Address; | ||
token: SymbolToken; | ||
} | ||
export type TransactionStatus = "pending" | "success" | "reverted"; | ||
@@ -128,2 +142,14 @@ export interface TransactionData { | ||
} | ||
export declare enum EscrowType { | ||
FixedPrice = 0, | ||
Milestone = 1, | ||
Hourly = 2 | ||
} | ||
export interface AbiList { | ||
fixedPriceAbi: readonly object[]; | ||
milestoneAbi: readonly object[]; | ||
hourlyAbi: readonly object[]; | ||
feeManagerAbi: readonly object[]; | ||
factoryAbi: readonly object[]; | ||
} | ||
export declare class MidcontractProtocol { | ||
@@ -139,3 +165,13 @@ private readonly contractList; | ||
private readonly ownerAddress; | ||
constructor(chain: Chain, transport: HttpTransport, contractList: ContractList, account?: Account); | ||
fixedPriceAbi: [ | ||
]; | ||
milestoneAbi: [ | ||
]; | ||
hourlyAbi: [ | ||
]; | ||
feeManagerAbi: [ | ||
]; | ||
factoryAbi: [ | ||
]; | ||
constructor(chain: Chain, transport: HttpTransport, contractList: ContractList, abiList: AbiList, account?: Account); | ||
static buildByEnvironment(name?: Environment, account?: Account, url?: string): MidcontractProtocol; | ||
@@ -153,2 +189,4 @@ /** @deprecated */ | ||
getDepositList(contractId: bigint): Promise<Deposit>; | ||
getDepositListMilestone(contractId: bigint, milestoneId: bigint): Promise<Deposit>; | ||
getDepositListHourly(contractId: bigint, weekId: bigint): Promise<Deposit>; | ||
currentContractId(): Promise<bigint>; | ||
@@ -168,12 +206,34 @@ get blockNumber(): Promise<number>; | ||
escrowDeposit(input: DepositInput, waitReceipt?: boolean): Promise<DepositResponse>; | ||
escrowMilestoneDeposit(deposits: DepositInput[], token: SymbolToken, escrowContractId?: bigint, waitReceipt?: boolean): Promise<DepositResponse>; | ||
escrowDepositHourly(deposits: DepositInput[], token: SymbolToken, escrowContractId?: bigint, waitReceipt?: boolean): Promise<DepositResponse>; | ||
escrowSubmit(contractId: bigint, salt: Hash, data: string, waitReceipt?: boolean): Promise<TransactionId>; | ||
escrowSubmitMilestone(contractId: bigint, milestoneId: bigint, salt: Hash, data: string, waitReceipt?: boolean): Promise<TransactionId>; | ||
escrowSubmitHourly(contractId: bigint, weekId: bigint, salt: Hash, data: string, waitReceipt?: boolean): Promise<TransactionId>; | ||
escrowRefill(contractId: bigint, value: number, waitReceipt?: boolean): Promise<TransactionId>; | ||
escrowRefillMilestone(contractId: bigint, milestoneId: bigint, value: number, waitReceipt?: boolean): Promise<TransactionId>; | ||
escrowRefillHourly(contractId: bigint, weekId: bigint, value: number, waitReceipt?: boolean): Promise<TransactionId>; | ||
escrowApprove(input: ApproveInput, waitReceipt?: boolean): Promise<TransactionId>; | ||
escrowApproveMilestone(input: ApproveInputMilestone, waitReceipt?: boolean): Promise<TransactionId>; | ||
escrowApproveHourly(input: ApproveInputHourly, waitReceipt?: boolean): Promise<TransactionId>; | ||
escrowClaim(contractId: bigint, waitReceipt?: boolean): Promise<TransactionId>; | ||
escrowClaimMilestone(contractId: bigint, milestoneId: bigint, waitReceipt?: boolean): Promise<TransactionId>; | ||
escrowClaimHourly(contractId: bigint, weekId: bigint, waitReceipt?: boolean): Promise<TransactionId>; | ||
escrowWithdraw(contractId: bigint, waitReceipt?: boolean): Promise<TransactionId>; | ||
escrowWithdrawMilestone(contractId: bigint, milestoneId: bigint, waitReceipt?: boolean): Promise<TransactionId>; | ||
escrowWithdrawHourly(contractId: bigint, weekId: bigint, waitReceipt?: boolean): Promise<TransactionId>; | ||
requestReturn(contractId: bigint, waitReceipt?: boolean): Promise<TransactionId>; | ||
requestReturnMilestone(contractId: bigint, milestoneId: bigint, waitReceipt?: boolean): Promise<TransactionId>; | ||
requestReturnHourly(contractId: bigint, weekId: bigint, waitReceipt?: boolean): Promise<TransactionId>; | ||
approveReturn(contractId: bigint, waitReceipt?: boolean): Promise<TransactionId>; | ||
approveReturnMilestone(contractId: bigint, milestoneId: bigint, waitReceipt?: boolean): Promise<TransactionId>; | ||
approveReturnHourly(contractId: bigint, weekId: bigint, waitReceipt?: boolean): Promise<TransactionId>; | ||
cancelReturn(contractId: bigint, status: DepositStatus, waitReceipt?: boolean): Promise<TransactionId>; | ||
cancelReturnMilestone(contractId: bigint, milestoneId: bigint, status: DepositStatus, waitReceipt?: boolean): Promise<TransactionId>; | ||
cancelReturnHourly(contractId: bigint, weekId: bigint, status: DepositStatus, waitReceipt?: boolean): Promise<TransactionId>; | ||
createDispute(contractId: bigint, waitReceipt?: boolean): Promise<TransactionId>; | ||
createDisputeMilestone(contractId: bigint, milestoneId: bigint, waitReceipt?: boolean): Promise<TransactionId>; | ||
createDisputeHourly(contractId: bigint, weekId: bigint, waitReceipt?: boolean): Promise<TransactionId>; | ||
resolveDispute(contractId: bigint, winner: DisputeWinner, clientAmount: number, contractorAmount: number, waitReceipt?: boolean): Promise<TransactionId>; | ||
resolveDisputeMilestone(contractId: bigint, milestoneId: bigint, winner: DisputeWinner, clientAmount: number, contractorAmount: number, waitReceipt?: boolean): Promise<TransactionId>; | ||
resolveDisputeHourly(contractId: bigint, weekId: bigint, winner: DisputeWinner, clientAmount: number, contractorAmount: number, waitReceipt?: boolean): Promise<TransactionId>; | ||
deployEscrow(): Promise<{ | ||
@@ -183,2 +243,10 @@ userEscrow: Address; | ||
}>; | ||
deployMilestoneEscrow(): Promise<{ | ||
userEscrow: Address; | ||
salt: Hash; | ||
}>; | ||
deployHourlyEscrow(): Promise<{ | ||
userEscrow: Address; | ||
salt: Hash; | ||
}>; | ||
updateDefaultFees(coverageFee: number, claimFee: number): Promise<void>; | ||
@@ -188,182 +256,36 @@ setSpecialFees(accountAddress: Address, coverageFee: number, claimFee: number): Promise<void>; | ||
transactionByHash(hash: Hash, waitReceipt?: boolean): Promise<TransactionData>; | ||
transactionByHashMilestoneWait(hash: Hash): Promise<TransactionData>; | ||
transactionByHashMilestone(hash: Hash, waitReceipt?: boolean): Promise<TransactionData>; | ||
transactionByHashHourlyWait(hash: Hash): Promise<TransactionData>; | ||
transactionByHashHourly(hash: Hash, waitReceipt?: boolean): Promise<TransactionData>; | ||
transactionParse(data: TransactionData): Promise<{ | ||
input: { | ||
args: readonly [ | ||
]; | ||
functionName: "registry"; | ||
} | { | ||
args: readonly [ | ||
bigint, | ||
bigint, | ||
`0x${string}` | ||
]; | ||
functionName: "approve"; | ||
} | { | ||
args: readonly [ | ||
bigint | ||
]; | ||
functionName: "approveReturn"; | ||
} | { | ||
args: readonly [ | ||
bigint, | ||
number | ||
]; | ||
functionName: "cancelReturn"; | ||
} | { | ||
args: readonly [ | ||
bigint | ||
]; | ||
functionName: "claim"; | ||
} | { | ||
args: readonly [ | ||
]; | ||
functionName: "client"; | ||
} | { | ||
args: readonly [ | ||
bigint | ||
]; | ||
functionName: "createDispute"; | ||
} | { | ||
args: readonly [ | ||
{ | ||
contractor: `0x${string}`; | ||
paymentToken: `0x${string}`; | ||
amount: bigint; | ||
amountToClaim: bigint; | ||
amountToWithdraw: bigint; | ||
timeLock: bigint; | ||
contractorData: `0x${string}`; | ||
feeConfig: number; | ||
status: number; | ||
} | ||
]; | ||
functionName: "deposit"; | ||
} | { | ||
args: readonly [ | ||
bigint | ||
]; | ||
functionName: "deposits"; | ||
} | { | ||
args: readonly [ | ||
`0x${string}`, | ||
`0x${string}` | ||
]; | ||
functionName: "getContractorDataHash"; | ||
} | { | ||
args: readonly [ | ||
]; | ||
functionName: "getCurrentContractId"; | ||
} | { | ||
args: readonly [ | ||
`0x${string}`, | ||
`0x${string}`, | ||
`0x${string}` | ||
]; | ||
functionName: "initialize"; | ||
} | { | ||
args: readonly [ | ||
]; | ||
functionName: "initialized"; | ||
} | { | ||
args: readonly [ | ||
`0x${string}`, | ||
`0x${string}` | ||
]; | ||
functionName: "isValidSignature"; | ||
} | { | ||
args: readonly [ | ||
]; | ||
functionName: "owner"; | ||
} | { | ||
args: readonly [ | ||
bigint, | ||
bigint | ||
]; | ||
functionName: "refill"; | ||
} | { | ||
args: readonly [ | ||
bigint | ||
]; | ||
functionName: "requestReturn"; | ||
} | { | ||
args: readonly [ | ||
bigint, | ||
number, | ||
bigint, | ||
bigint | ||
]; | ||
functionName: "resolveDispute"; | ||
} | { | ||
args: readonly [ | ||
bigint, | ||
`0x${string}`, | ||
`0x${string}` | ||
]; | ||
functionName: "submit"; | ||
} | { | ||
args: readonly [ | ||
`0x${string}` | ||
]; | ||
functionName: "transferOwnership"; | ||
} | { | ||
args: readonly [ | ||
`0x${string}` | ||
]; | ||
functionName: "updateRegistry"; | ||
} | { | ||
args: readonly [ | ||
bigint | ||
]; | ||
functionName: "withdraw"; | ||
args: readonly unknown[]; | ||
functionName: string; | ||
}; | ||
events: { | ||
eventName: "Approved" | "Claimed" | "Deposited" | "DisputeCreated" | "DisputeResolved" | "OwnershipTransferred" | "Refilled" | "RegistryUpdated" | "ReturnApproved" | "ReturnCanceled" | "ReturnRequested" | "Submitted" | "Withdrawn"; | ||
args: { | ||
contractId: bigint; | ||
amountApprove: bigint; | ||
receiver: `0x${string}`; | ||
} | { | ||
contractId: bigint; | ||
paymentToken: `0x${string}`; | ||
amount: bigint; | ||
} | { | ||
sender: `0x${string}`; | ||
contractId: bigint; | ||
paymentToken: `0x${string}`; | ||
amount: bigint; | ||
timeLock: bigint; | ||
feeConfig: number; | ||
} | { | ||
contractId: bigint; | ||
sender: `0x${string}`; | ||
} | { | ||
contractId: bigint; | ||
winner: number; | ||
clientAmount: bigint; | ||
contractorAmount: bigint; | ||
} | { | ||
oldOwner: `0x${string}`; | ||
newOwner: `0x${string}`; | ||
} | { | ||
contractId: bigint; | ||
amountAdditional: bigint; | ||
} | { | ||
registry: `0x${string}`; | ||
} | { | ||
contractId: bigint; | ||
sender: `0x${string}`; | ||
} | { | ||
contractId: bigint; | ||
} | { | ||
contractId: bigint; | ||
} | { | ||
sender: `0x${string}`; | ||
contractId: bigint; | ||
} | { | ||
contractId: bigint; | ||
paymentToken: `0x${string}`; | ||
amount: bigint; | ||
}; | ||
eventName: string; | ||
args: readonly unknown[] | Record<string, unknown>; | ||
}[]; | ||
}>; | ||
transactionParseMilestone(data: TransactionData): Promise<{ | ||
input: { | ||
args: readonly unknown[]; | ||
functionName: string; | ||
}; | ||
events: { | ||
eventName: string; | ||
args: readonly unknown[] | Record<string, unknown>; | ||
}[]; | ||
}>; | ||
transactionParseHourly(data: TransactionData): Promise<{ | ||
input: { | ||
args: readonly unknown[]; | ||
functionName: string; | ||
}; | ||
events: { | ||
eventName: string; | ||
args: readonly unknown[] | Record<string, unknown>; | ||
}[]; | ||
}>; | ||
private get tokenList(); | ||
@@ -375,3 +297,7 @@ parseAmount(tokenAddress: Address, amount: bigint): { | ||
private parseLogs; | ||
private parseLogsMilestone; | ||
private parseLogsHourly; | ||
private parseInput; | ||
private parseInputMilestone; | ||
private parseInputHourly; | ||
private send; | ||
@@ -378,0 +304,0 @@ private generateRandomNumber; |
{ | ||
"name": "@midcontract/protocol", | ||
"version": "1.0.0-rc.26", | ||
"version": "1.0.0-rc.27", | ||
"description": "Crypto payment protocol with escrow", | ||
@@ -43,3 +43,3 @@ "keywords": [ | ||
"build": "rimraf build/**/* && pnpm build:chain && pnpm build:sdk", | ||
"build:abi": "echo \"export const escrow = $(jq '.abi' out/Escrow.sol/Escrow.json) as const\" > sdk/abi/Escrow.ts", | ||
"build:abi": "echo \\\\\\\"export const escrow = $(jq '.abi' out/Escrow.sol/Escrow.json) as const\\\\\\\" > sdk/abi/EscrowFixedPrice.ts", | ||
"build:chain": "pnpm build:remap && forge build && pnpm build:abi", | ||
@@ -50,3 +50,3 @@ "build:optimized": "FOUNDRY_PROFILE=optimized forge build", | ||
"build:types": "npx dts-bundle-generator --silent --no-check --out-file dist/index.d.ts sdk/index.ts", | ||
"canary": "pnpm canary:version && npm publish --access public --tag canary", | ||
"canary": "pnpm canary:version && npm publish --access public --tag canary --no-git-tag-version", | ||
"canary:version": "pnpm version --new-version $(jq -r .version package.json)-$(git log -n 1 --pretty=format:%h) --no-git-tag-version", | ||
@@ -53,0 +53,0 @@ "deploy:blast": "source .env && forge script Deployment --broadcast --rpc-url $BLAST_RPC --private-key $BLAST_DEPLOYER_PK --verifier-url $BLAST_VERIFIER_URL --etherscan-api-key $BLAST_ETHERSCAN_API_KEY", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
580429
11822