Skip to content

Commit

Permalink
Add method and flow to add an existing vesting contract
Browse files Browse the repository at this point in the history
  • Loading branch information
sisou committed Nov 24, 2020
1 parent f3090aa commit 1dca430
Show file tree
Hide file tree
Showing 10 changed files with 319 additions and 6 deletions.
7 changes: 7 additions & 0 deletions client/HubApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,13 @@ export default class HubApi<DB extends BehaviorType = BehaviorType.POPUP> { // D
return this._request(requestBehavior, RequestType.RENAME, [request]);
}

public addVestingContract<B extends BehaviorType = DB>(
request: Promise<BasicRequest> | BasicRequest,
requestBehavior: RequestBehavior<B> = this._defaultBehavior as any,
): Promise<B extends BehaviorType.REDIRECT ? void : Account> {
return this._request(requestBehavior, RequestType.ADD_VESTING_CONTRACT, [request]);
}

public migrate<B extends BehaviorType = DB>(
requestBehavior: RequestBehavior<B> = this._defaultBehavior as any,
): Promise<B extends BehaviorType.REDIRECT ? void : Account[]> {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@nimiq/iqons": "^1.5.2",
"@nimiq/keyguard-client": "^1.3.0",
"@nimiq/ledger-api": "^1.1.0",
"@nimiq/network-client": "^0.4.0",
"@nimiq/network-client": "^0.6.2",
"@nimiq/rpc": "^0.4.1",
"@nimiq/style": "^0.8.2",
"@nimiq/utils": "^0.5.0",
Expand Down
2 changes: 1 addition & 1 deletion src/components/Network.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template></template>

<script lang="ts">
import { Component, Prop, Vue } from 'vue-property-decorator';
import { Component, Vue } from 'vue-property-decorator';
import { SignedTransaction } from '../lib/PublicRequestTypes';
import { NetworkClient, DetailedPlainTransaction } from '@nimiq/network-client';
import Config from 'config';
Expand Down
46 changes: 46 additions & 0 deletions src/i18n/en.po
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ msgstr ""
msgid "Add a message..."
msgstr ""

#: src/views/AddVestingContract.vue:51
msgid "Add contract"
msgstr ""

#: src/views/AddAccountSelection.vue:4
msgid "Add to account"
msgstr ""
Expand All @@ -70,6 +74,10 @@ msgstr ""
msgid "Add to Ledger"
msgstr ""

#: src/views/AddVestingContract.vue:4
msgid "Add Vesting Contract"
msgstr ""

#: src/views/AddAddressLedger.vue:16
msgid "Address Added"
msgstr ""
Expand All @@ -87,6 +95,10 @@ msgstr ""
msgid "Amount"
msgstr ""

#: src/views/AddVestingContract.vue:40
msgid "Amount/Step:"
msgstr ""

#: src/views/CashlinkManage.vue:158
#: src/views/CheckoutTransmission.vue:77
msgid "Awaiting receipt confirmation..."
Expand Down Expand Up @@ -153,6 +165,14 @@ msgstr ""
msgid "Backed Up"
msgstr ""

#: src/views/AddVestingContract.vue:28
msgid "Balance:"
msgstr ""

#: src/views/AddVestingContract.vue:36
msgid "Blocks/Step:"
msgstr ""

#: src/lib/LabelingMachine.ts:43
msgid "Blue"
msgstr ""
Expand Down Expand Up @@ -347,6 +367,14 @@ msgstr ""
msgid "Continue"
msgstr ""

#: src/views/AddVestingContract.vue:56
msgid "Contract added."
msgstr ""

#: src/views/AddVestingContract.vue:20
msgid "Contract Information"
msgstr ""

#: src/views/CashlinkManage.vue:32
msgid "Copied"
msgstr ""
Expand Down Expand Up @@ -409,6 +437,10 @@ msgstr ""
msgid "Enter manually"
msgstr ""

#: src/views/AddVestingContract.vue:45
msgid "Enter the address of a vesting contract."
msgstr ""

#: src/views/CashlinkCreate.vue:159
msgid "express"
msgstr ""
Expand All @@ -431,6 +463,10 @@ msgstr ""
msgid "Fetching Addresses"
msgstr ""

#: src/views/AddVestingContract.vue:16
msgid "Fetching contract information..."
msgstr ""

#: src/views/LoginSuccess.vue:42
msgid "Fetching your addresses"
msgstr ""
Expand Down Expand Up @@ -621,6 +657,10 @@ msgstr ""
msgid "Orange"
msgstr ""

#: src/views/AddVestingContract.vue:22
msgid "Owner:"
msgstr ""

#: src/components/NonNimiqCheckoutCard.vue:103
msgid "Pay with {currencyFullName}"
msgstr ""
Expand Down Expand Up @@ -765,11 +805,16 @@ msgstr ""
msgid "standard"
msgstr ""

#: src/views/AddVestingContract.vue:32
msgid "Start Block:"
msgstr ""

#: src/views/Migrate.vue:232
msgid "Storing your new accounts..."
msgstr ""

#: src/components/NimiqCheckoutCard.vue:277
#: src/views/AddVestingContract.vue:11
#: src/views/CashlinkManage.vue:154
#: src/views/CheckoutTransmission.vue:73
msgid "Syncing consensus..."
Expand Down Expand Up @@ -903,6 +948,7 @@ msgid "Verify Payment"
msgstr ""

#: src/lib/LabelingMachine.ts:25
#: src/views/AddVestingContract.vue:137
msgid "Vesting Contract"
msgstr ""

Expand Down
1 change: 1 addition & 0 deletions src/lib/PublicRequestTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export enum RequestType {
LOGOUT = 'logout',
ADD_ADDRESS = 'add-address',
RENAME = 'rename',
ADD_VESTING_CONTRACT = 'add-vesting-contract',
CHOOSE_ADDRESS = 'choose-address',
CREATE_CASHLINK = 'create-cashlink',
MANAGE_CASHLINK = 'manage-cashlink',
Expand Down
2 changes: 2 additions & 0 deletions src/lib/RequestParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ export class RequestParser {
case RequestType.CHOOSE_ADDRESS:
case RequestType.LOGIN:
case RequestType.MIGRATE:
case RequestType.ADD_VESTING_CONTRACT:
return {
kind: requestType,
appName: request.appName,
Expand Down Expand Up @@ -451,6 +452,7 @@ export class RequestParser {
case RequestType.CHOOSE_ADDRESS:
case RequestType.LOGIN:
case RequestType.MIGRATE:
case RequestType.ADD_VESTING_CONTRACT:
return {
appName: request.appName,
} as BasicRequest;
Expand Down
1 change: 1 addition & 0 deletions src/lib/RpcApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export default class RpcApi {
RequestType.LOGOUT,
RequestType.ADD_ADDRESS,
RequestType.RENAME,
RequestType.ADD_VESTING_CONTRACT,
RequestType.SIGN_MESSAGE,
RequestType.MIGRATE,
RequestType.CHOOSE_ADDRESS,
Expand Down
7 changes: 7 additions & 0 deletions src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ const AddAddressLedger = () => import(/*webpackChunkName: "add-ledger"*/
const OnboardingSelector = () => import(/*webpackChunkName: "onboarding"*/ './views/OnboardingSelector.vue');

const Rename = () => import(/*webpackChunkName: "rename"*/ './views/Rename.vue');
const AddVestingContract = () => import(/*webpackChunkName: "add-vesting-contract"*/
'./views/AddVestingContract.vue');

const Migrate = () => import(/*webpackChunkName: "migrate"*/ './views/Migrate.vue');

Expand Down Expand Up @@ -247,6 +249,11 @@ export default new Router({
component: Rename,
name: RequestType.RENAME,
},
{
path: `/${RequestType.ADD_VESTING_CONTRACT}`,
component: AddVestingContract,
name: RequestType.ADD_VESTING_CONTRACT,
},
{
path: `/${RequestType.MIGRATE}`,
component: Migrate,
Expand Down
Loading

0 comments on commit 1dca430

Please sign in to comment.