Implement payments for app deployments #17

Merged
nabarun merged 27 commits from iv-integrate-payments into main 2024-10-28 09:46:19 +00:00
4 changed files with 11 additions and 14 deletions
Showing only changes of commit b8c31df54f - Show all commits

View File

@ -499,16 +499,15 @@ export class Registry {
);
}
async getAddress(): Promise<any> {
async getAccount(): Promise<Account> {
const account = new Account(Buffer.from(this.registryConfig.privateKey, 'hex'));
await account.init();
return account.address;
return account;
}
async getTxResponse(txHash: string): Promise<IndexedTx | null> {
const account = new Account(Buffer.from(this.registryConfig.privateKey, 'hex'));
await account.init();
const account = await this.getAccount();
const laconicClient = await this.registry.getLaconicClient(account);
const txResponse: IndexedTx | null = await laconicClient.getTx(txHash);

View File

@ -213,7 +213,7 @@ export class Service {
const fundsReleased = await this.releaseDeployerFundsByProjectId(deployment.projectId);
// Return remaining amount to owner
await this.returnCreatorFundsByProjectId(deployment.projectId, true);
await this.returnUserFundsByProjectId(deployment.projectId, true);
await this.db.updateProjectById(deployment.projectId, {
fundsReleased,
@ -314,7 +314,7 @@ export class Service {
log(`No winning deployer for auction ${project!.auctionId}`);
// Return all funds to the owner
await this.returnCreatorFundsByProjectId(project.id, false)
await this.returnUserFundsByProjectId(project.id, false)
} else {
const deployers = await this.saveDeployersByDeployerRecords(deployerRecords);
for (const deployer of deployers) {
@ -1332,7 +1332,7 @@ export class Service {
return false;
}
async returnCreatorFundsByProjectId(projectId: string, winningDeployersPresent: boolean) {
async returnUserFundsByProjectId(projectId: string, winningDeployersPresent: boolean) {
const project = await this.db.getProjectById(projectId);
if (!project || !project.auctionId) {
@ -1405,7 +1405,9 @@ export class Service {
}
async getAddress(): Promise<any> {
return this.laconicRegistry.getAddress();
const account = await this.laconicRegistry.getAccount();
return account.address;
}
async verifyTx(txHash: string, amountSent: string, senderAddress: string): Promise<boolean> {

View File

@ -23,11 +23,7 @@ const Stopwatch = ({ offsetTimestamp, isPaused, ...props }: StopwatchProps) => {
});
useEffect(() => {
if (isPaused) {
pause();
} else {
start();
}
isPaused ? pause() : start();
}, [isPaused]);
return <FormatMillisecond time={totalSeconds * 1000} {...props} />;

View File

@ -32,7 +32,7 @@ const ConnectWallet = ({
>
{accounts.map((account, index) => (
<Option key={index} value={account.address}>
{account.address}
{account.address.split(':').slice(1).join(':')}
</Option>
))}
</Select>