Implement payments for app deployments #17
@ -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'));
|
const account = new Account(Buffer.from(this.registryConfig.privateKey, 'hex'));
|
||||||
await account.init();
|
await account.init();
|
||||||
|
|
||||||
return account.address;
|
return account;
|
||||||
}
|
}
|
||||||
|
|
||||||
async getTxResponse(txHash: string): Promise<IndexedTx | null> {
|
async getTxResponse(txHash: string): Promise<IndexedTx | null> {
|
||||||
const account = new Account(Buffer.from(this.registryConfig.privateKey, 'hex'));
|
const account = await this.getAccount();
|
||||||
await account.init();
|
|
||||||
const laconicClient = await this.registry.getLaconicClient(account);
|
const laconicClient = await this.registry.getLaconicClient(account);
|
||||||
const txResponse: IndexedTx | null = await laconicClient.getTx(txHash);
|
const txResponse: IndexedTx | null = await laconicClient.getTx(txHash);
|
||||||
|
|
||||||
|
@ -213,7 +213,7 @@ export class Service {
|
|||||||
const fundsReleased = await this.releaseDeployerFundsByProjectId(deployment.projectId);
|
const fundsReleased = await this.releaseDeployerFundsByProjectId(deployment.projectId);
|
||||||
|
|
||||||
// Return remaining amount to owner
|
// Return remaining amount to owner
|
||||||
await this.returnCreatorFundsByProjectId(deployment.projectId, true);
|
await this.returnUserFundsByProjectId(deployment.projectId, true);
|
||||||
|
|
||||||
await this.db.updateProjectById(deployment.projectId, {
|
await this.db.updateProjectById(deployment.projectId, {
|
||||||
fundsReleased,
|
fundsReleased,
|
||||||
@ -314,7 +314,7 @@ export class Service {
|
|||||||
log(`No winning deployer for auction ${project!.auctionId}`);
|
log(`No winning deployer for auction ${project!.auctionId}`);
|
||||||
|
|
||||||
// Return all funds to the owner
|
// Return all funds to the owner
|
||||||
await this.returnCreatorFundsByProjectId(project.id, false)
|
await this.returnUserFundsByProjectId(project.id, false)
|
||||||
} else {
|
} else {
|
||||||
const deployers = await this.saveDeployersByDeployerRecords(deployerRecords);
|
const deployers = await this.saveDeployersByDeployerRecords(deployerRecords);
|
||||||
for (const deployer of deployers) {
|
for (const deployer of deployers) {
|
||||||
@ -1332,7 +1332,7 @@ export class Service {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
async returnCreatorFundsByProjectId(projectId: string, winningDeployersPresent: boolean) {
|
async returnUserFundsByProjectId(projectId: string, winningDeployersPresent: boolean) {
|
||||||
const project = await this.db.getProjectById(projectId);
|
const project = await this.db.getProjectById(projectId);
|
||||||
|
|
||||||
if (!project || !project.auctionId) {
|
if (!project || !project.auctionId) {
|
||||||
@ -1405,7 +1405,9 @@ export class Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getAddress(): Promise<any> {
|
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> {
|
async verifyTx(txHash: string, amountSent: string, senderAddress: string): Promise<boolean> {
|
||||||
|
@ -23,11 +23,7 @@ const Stopwatch = ({ offsetTimestamp, isPaused, ...props }: StopwatchProps) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isPaused) {
|
isPaused ? pause() : start();
|
||||||
pause();
|
|
||||||
} else {
|
|
||||||
start();
|
|
||||||
}
|
|
||||||
}, [isPaused]);
|
}, [isPaused]);
|
||||||
|
|
||||||
return <FormatMillisecond time={totalSeconds * 1000} {...props} />;
|
return <FormatMillisecond time={totalSeconds * 1000} {...props} />;
|
||||||
|
@ -32,7 +32,7 @@ const ConnectWallet = ({
|
|||||||
>
|
>
|
||||||
{accounts.map((account, index) => (
|
{accounts.map((account, index) => (
|
||||||
<Option key={index} value={account.address}>
|
<Option key={index} value={account.address}>
|
||||||
{account.address}
|
{account.address.split(':').slice(1).join(':')}
|
||||||
</Option>
|
</Option>
|
||||||
))}
|
))}
|
||||||
</Select>
|
</Select>
|
||||||
|
Loading…
Reference in New Issue
Block a user