Skip to content

Commit

Permalink
feat: use CAIP-19 asset type and StringNumber
Browse files Browse the repository at this point in the history
  • Loading branch information
danroc committed Oct 10, 2024
1 parent 9424622 commit c77bdf0
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 17 deletions.
2 changes: 1 addition & 1 deletion packages/keyring-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"dependencies": {
"@metamask/snaps-sdk": "^6.7.0",
"@metamask/superstruct": "^3.1.0",
"@metamask/utils": "^9.2.1",
"@metamask/utils": "^9.3.0",
"@types/uuid": "^9.0.8",
"bech32": "^2.0.0",
"uuid": "^9.0.1",
Expand Down
14 changes: 7 additions & 7 deletions packages/keyring-api/src/api/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import { UuidStruct } from '../utils';
*/
const AssetStruct = object({
/**
* Asset ID (CAIP-19).
* Asset type (CAIP-19).
*/
id: string(),
type: CaipAssetTypeStruct,

/**
* Unit of the asset. This has to be one of the supported units for the
Expand All @@ -47,7 +47,7 @@ const AmountStruct = object({
/**
* Amount in decimal string format.
*/
amount: string(),
amount: StringNumberStruct,

/**
* Asset information.
Expand Down Expand Up @@ -101,7 +101,7 @@ const ParticipantStruct = object({
* "address": "bc1qrp0yzgkf8rawkuvdlhnjfj2fnjwm0m8727kgah",
* "amount": "0.2001",
* "asset": {
* "id": "bip122:000000000019d6689c085ae165831e93/slip44:0",
* "type": "bip122:000000000019d6689c085ae165831e93/slip44:0",
* "unit": "BTC"
* }
* }
Expand All @@ -111,23 +111,23 @@ const ParticipantStruct = object({
* "address": "bc1qrp0yzgkf8rawkuvdlhnjfj2fnjwm0m8727kgah",
* "amount": "0.1",
* "asset": {
* "id": "bip122:000000000019d6689c085ae165831e93/slip44:0",
* "type": "bip122:000000000019d6689c085ae165831e93/slip44:0",
* "unit": "BTC"
* }
* },
* {
* "address": "bc1qrp0yzgkf8rawkuvdlhnjfj2fnjwm0m8727kgah",
* "amount": "0.1",
* "asset": {
* "id": "bip122:000000000019d6689c085ae165831e93/slip44:0",
* "type": "bip122:000000000019d6689c085ae165831e93/slip44:0",
* "unit": "BTC"
* }
* }
* ],
* "fee": {
* "amount": "0.0001",
* "asset": {
* "id": "bip122:000000000019d6689c085ae165831e93/slip44:0",
* "type": "bip122:000000000019d6689c085ae165831e93/slip44:0",
* "unit": "BTC"
* }
* }
Expand Down
2 changes: 1 addition & 1 deletion packages/keyring-eth-hd/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@ethereumjs/util": "^8.1.0",
"@metamask/eth-sig-util": "^7.0.3",
"@metamask/scure-bip39": "^2.1.1",
"@metamask/utils": "^9.2.1",
"@metamask/utils": "^9.3.0",
"ethereum-cryptography": "^2.1.2"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/keyring-eth-ledger-bridge/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"@ledgerhq/types-cryptoassets": "^7.15.1",
"@ledgerhq/types-devices": "^6.25.3",
"@metamask/auto-changelog": "^3.4.4",
"@metamask/utils": "^9.2.1",
"@metamask/utils": "^9.3.0",
"@types/ethereumjs-tx": "^1.0.1",
"@types/hdkey": "^2.0.1",
"@types/jest": "^29.5.12",
Expand Down
2 changes: 1 addition & 1 deletion packages/keyring-eth-simple/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"dependencies": {
"@ethereumjs/util": "^8.1.0",
"@metamask/eth-sig-util": "^7.0.3",
"@metamask/utils": "^9.2.1",
"@metamask/utils": "^9.3.0",
"ethereum-cryptography": "^2.1.2",
"randombytes": "^2.1.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/keyring-snap-bridge/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@metamask/snaps-sdk": "^6.7.0",
"@metamask/snaps-utils": "^8.3.0",
"@metamask/superstruct": "^3.1.0",
"@metamask/utils": "^9.2.1",
"@metamask/utils": "^9.3.0",
"@types/uuid": "^9.0.8",
"uuid": "^9.0.1"
},
Expand Down
27 changes: 22 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1877,7 +1877,7 @@ __metadata:
"@metamask/eth-hd-keyring": "npm:4.0.1"
"@metamask/eth-sig-util": "npm:^7.0.3"
"@metamask/scure-bip39": "npm:^2.1.1"
"@metamask/utils": "npm:^9.2.1"
"@metamask/utils": "npm:^9.3.0"
"@types/jest": "npm:^29.5.12"
deepmerge: "npm:^4.2.2"
ethereum-cryptography: "npm:^2.1.2"
Expand All @@ -1901,7 +1901,7 @@ __metadata:
"@ledgerhq/types-devices": "npm:^6.25.3"
"@metamask/auto-changelog": "npm:^3.4.4"
"@metamask/eth-sig-util": "npm:^7.0.3"
"@metamask/utils": "npm:^9.2.1"
"@metamask/utils": "npm:^9.3.0"
"@types/ethereumjs-tx": "npm:^1.0.1"
"@types/hdkey": "npm:^2.0.1"
"@types/jest": "npm:^29.5.12"
Expand Down Expand Up @@ -1968,7 +1968,7 @@ __metadata:
"@lavamoat/preinstall-always-fail": "npm:^2.1.0"
"@metamask/auto-changelog": "npm:^3.4.4"
"@metamask/eth-sig-util": "npm:^7.0.3"
"@metamask/utils": "npm:^9.2.1"
"@metamask/utils": "npm:^9.3.0"
"@types/ethereumjs-tx": "npm:^1.0.1"
"@types/jest": "npm:^29.5.12"
"@types/node": "npm:^20.12.12"
Expand Down Expand Up @@ -1999,7 +1999,7 @@ __metadata:
"@metamask/snaps-sdk": "npm:^6.7.0"
"@metamask/snaps-utils": "npm:^8.3.0"
"@metamask/superstruct": "npm:^3.1.0"
"@metamask/utils": "npm:^9.2.1"
"@metamask/utils": "npm:^9.3.0"
"@types/jest": "npm:^29.5.12"
"@types/node": "npm:^20.12.12"
"@types/uuid": "npm:^9.0.8"
Expand Down Expand Up @@ -2112,7 +2112,7 @@ __metadata:
"@metamask/providers": "npm:^17.2.0"
"@metamask/snaps-sdk": "npm:^6.7.0"
"@metamask/superstruct": "npm:^3.1.0"
"@metamask/utils": "npm:^9.2.1"
"@metamask/utils": "npm:^9.3.0"
"@types/jest": "npm:^29.5.12"
"@types/node": "npm:^20.12.12"
"@types/uuid": "npm:^9.0.8"
Expand Down Expand Up @@ -2388,6 +2388,23 @@ __metadata:
languageName: node
linkType: hard

"@metamask/utils@npm:^9.3.0":
version: 9.3.0
resolution: "@metamask/utils@npm:9.3.0"
dependencies:
"@ethereumjs/tx": "npm:^4.2.0"
"@metamask/superstruct": "npm:^3.1.0"
"@noble/hashes": "npm:^1.3.1"
"@scure/base": "npm:^1.1.3"
"@types/debug": "npm:^4.1.7"
debug: "npm:^4.3.4"
pony-cause: "npm:^2.1.10"
semver: "npm:^7.5.4"
uuid: "npm:^9.0.1"
checksum: 10/ed6648cd973bbf3b4eb0e862903b795a99d27784c820e19f62f0bc0ddf353e98c2858d7e9aaebc0249a586391b344e35b9249d13c08e3ea0c74b23dc1c6b1558
languageName: node
linkType: hard

"@mobily/ts-belt@npm:^3.13.1":
version: 3.13.1
resolution: "@mobily/ts-belt@npm:3.13.1"
Expand Down

0 comments on commit c77bdf0

Please sign in to comment.