Skip to content

Commit

Permalink
Merge #2662 #2671
Browse files Browse the repository at this point in the history
2662: Basic migration plans e2e tests r=rvl a=piotr-iohk

# Issue Number

ADP-680


# Overview

<!-- Detail in a few bullet points the work accomplished in this PR -->

- [ ] e2e tests on testnet for creating migration plans for Byron/Icarus/Shelley wallets.


# Comments

<!-- Additional comments or screenshots to attach if any -->

<!--
Don't forget to:

 ✓ Self-review your changes to make sure nothing unexpected slipped through
 ✓ Assign yourself to the PR
 ✓ Assign one or several reviewer(s)
 ✓ Jira will detect and link to this PR once created, but you can also link this PR in the description of the corresponding ticket
 ✓ Acknowledge any changes required to the Wiki
 ✓ Finally, in the PR description delete any empty sections and all text commented in <!--, so that this text does not appear in merge commit messages.
-->


2671: swagger: Add decimals field r=rvl a=rvl

### Issue Number

ADP-915

### Overview

Updates the swagger documentation to replace `unit` with `decimals`.



Co-authored-by: Piotr Stachyra <piotr.stachyra@iohk.io>
Co-authored-by: Rodney Lorrimar <rodney.lorrimar@iohk.io>
  • Loading branch information
3 people committed May 26, 2021
3 parents 93daf60 + fd1ab21 + d9355d6 commit 452c2da
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 29 deletions.
39 changes: 13 additions & 26 deletions specifications/api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -671,32 +671,19 @@ x-assetMetadataDescription: &assetMetadataDescription
type: string
maxLength: 500

x-assetMetadataUnit: &assetMetadataUnit
type: object
x-assetMetadataDecimals: &assetMetadataDecimals
type: integer
description: |
Defines a larger unit for the asset, in the same way Ada is the
larger unit of Lovelace.
required:
- decimals
- name
additionalProperties: false
properties:
decimals:
type: integer
description: |
The number of digits after the decimal point.
minimum: 1
maximum: 19
name:
type: string
minLength: 1
maxLength: 30
description: |
The human-readable name for the larger unit of the asset. Used
for display in user interfaces.
example:
name: API
decimals: 3
Defines a scaling factor for the asset of 10<sup>-n</sup>. The
decimals value _n_ is therefore the number of digits after the
decimal point for quantities of this token.
It is up to API clients to use this metadata field to decimalize
asset quantities before displaying to users. The wallet backend
will always return unscaled token quantities as whole numbers.
minimum: 0
maximum: 255
example: 2

x-assetMetadataUrl: &assetMetadataUrl
description: |
Expand Down Expand Up @@ -736,7 +723,7 @@ x-assetMetadata: &assetMetadata
name: *assetMetadataName
description: *assetMetadataDescription
ticker: *assetMetadataTicker
unit: *assetMetadataUnit
decimals: *assetMetadataDecimals
url: *assetMetadataUrl
logo: *assetMetadataLogo

Expand Down
3 changes: 2 additions & 1 deletion test/e2e/spec/byron_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,8 @@
addrs = SHELLEY.addresses.list(target_id).map { |a| a['id'] }

plan = BYRON.migrations.plan(id, addrs)
expect(plan).to be_correct_and_respond 501
expect(plan).to be_correct_and_respond 403
expect(plan.to_s).to include "nothing_to_migrate"
end

it "I could create migration plan - random" do
Expand Down
44 changes: 42 additions & 2 deletions test/e2e/spec/e2e_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
wait_for_all_byron_wallets(@nighly_byron_wallets)
wait_for_all_shelley_wallets(@nightly_shelley_wallets)


# @wid_rnd = "94c0af1034914f4455b7eb795ebea74392deafe9"
# @wid_ic = "a468e96ab85ad2043e48cf2e5f3437b4356769f4"
# @wid = "b1fb863243a9ae451bc4e2e662f60ff217b126e2"
# @target_id_pools = "4eff7771b9975e0731e2c5eb9695fece9067ee92"
end

after(:all) do
Expand Down Expand Up @@ -129,6 +129,20 @@

end

describe "Shelley Migrations" do
it "I can create migration plan shelley -> shelley" do
target_id = create_shelley_wallet
addrs = SHELLEY.addresses.list(target_id).map { |a| a['id'] }

plan = SHELLEY.migrations.plan(@wid, addrs)
expect(plan).to be_correct_and_respond 202
expect(plan['balance_selected']['assets']).not_to be []
expect(plan['balance_leftover']).to eq ({ "ada" => { "quantity" => 0,
"unit" => "lovelace" },
"assets" => [] })
end
end

describe "Shelley Transactions" do
it "I can send transaction and funds are received" do
amt = 1000000
Expand Down Expand Up @@ -494,6 +508,32 @@ def test_byron_assets_tx(source_id, target_id)
end
end

describe "Byron Migrations" do
it "I can create migration plan byron -> shelley" do
target_id = create_shelley_wallet
addrs = SHELLEY.addresses.list(target_id).map { |a| a['id'] }

plan = BYRON.migrations.plan(@wid_rnd, addrs)
expect(plan).to be_correct_and_respond 202
expect(plan['balance_selected']['assets']).not_to be []
expect(plan['balance_leftover']).to eq ({ "ada" => { "quantity" => 0,
"unit" => "lovelace" },
"assets" => [] })
end

it "I can create migration plan icarus -> shelley" do
target_id = create_shelley_wallet
addrs = SHELLEY.addresses.list(target_id).map { |a| a['id'] }

plan = BYRON.migrations.plan(@wid_ic, addrs)
expect(plan).to be_correct_and_respond 202
expect(plan['balance_selected']['assets']).not_to be []
expect(plan['balance_leftover']).to eq ({ "ada" => { "quantity" => 0,
"unit" => "lovelace" },
"assets" => [] })
end
end

describe "Native Assets" do

it "I can list assets -> random" do
Expand Down

0 comments on commit 452c2da

Please sign in to comment.