hpw-convert-eip681 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -3
- package/hpw_convert_eip681.d.ts +1 -0
- package/hpw_convert_eip681_bg.js +12 -0
- package/hpw_convert_eip681_bg.wasm +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
## 対象とするURL形式
|
|
28
28
|
|
|
29
29
|
```
|
|
30
|
-
https://link.expo2025-wallet.com/pay?to=<address>&master_currency_id=487&amount=<hex>&to_name=<label>
|
|
30
|
+
https://link.expo2025-wallet.com/pay?to=<address>&master_currency_id=487&amount=<hex>&to_name=<label>&type=<type>
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
これをEIP-681形式に変換します:
|
|
@@ -42,6 +42,11 @@ ethereum:<JPYCコントラクトアドレス>@137/transfer?address=<to>&uint256=
|
|
|
42
42
|
許容している(受け取り側のウォレットがユーザーに入力させる)ことに
|
|
43
43
|
対応したものです。
|
|
44
44
|
|
|
45
|
+
`type`(例: `dynamic`)は `to_name` と同様、解釈や検証を加えず生の
|
|
46
|
+
文字列のまま `link_type`(JS側では `linkType`)として保持します。
|
|
47
|
+
取りうる値の全体像が未確認のため、真偽値等には決め打ちしていません。
|
|
48
|
+
パラメータが存在しない場合は `None`(JS側では `undefined`)です。
|
|
49
|
+
|
|
45
50
|
## インストール
|
|
46
51
|
|
|
47
52
|
### Rust (`core`)
|
|
@@ -89,6 +94,9 @@ fn main() {
|
|
|
89
94
|
// まとめて取得することもできる
|
|
90
95
|
let addr_amount = link.address_amount();
|
|
91
96
|
println!("{} / {:?}", addr_amount.address, addr_amount.amount);
|
|
97
|
+
|
|
98
|
+
// to_name / link_type は生のまま(None は「パラメータ自体が無い」)
|
|
99
|
+
println!("to_name: {:?}, link_type: {:?}", link.to_name, link.link_type);
|
|
92
100
|
}
|
|
93
101
|
```
|
|
94
102
|
|
|
@@ -116,8 +124,8 @@ try {
|
|
|
116
124
|
// アドレスと金額を個別に取得する(amountは元URLに無い場合 undefined になる)
|
|
117
125
|
console.log(link.to, link.amount, link.amountHex);
|
|
118
126
|
|
|
119
|
-
//
|
|
120
|
-
console.log(link.chainId, link.currencySymbol, link.currencyContract, link.toName);
|
|
127
|
+
// その他のフィールド(toName/linkType は元URLに無い場合 undefined)
|
|
128
|
+
console.log(link.chainId, link.currencySymbol, link.currencyContract, link.toName, link.linkType);
|
|
121
129
|
} catch (err) {
|
|
122
130
|
console.error(err.kind, err);
|
|
123
131
|
}
|
package/hpw_convert_eip681.d.ts
CHANGED
package/hpw_convert_eip681_bg.js
CHANGED
|
@@ -76,6 +76,18 @@ export class ParsedLink {
|
|
|
76
76
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* @returns {string | undefined}
|
|
81
|
+
*/
|
|
82
|
+
get linkType() {
|
|
83
|
+
const ret = wasm.parsedlink_linkType(this.__wbg_ptr);
|
|
84
|
+
let v1;
|
|
85
|
+
if (ret[0] !== 0) {
|
|
86
|
+
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
87
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
88
|
+
}
|
|
89
|
+
return v1;
|
|
90
|
+
}
|
|
79
91
|
/**
|
|
80
92
|
* @returns {string}
|
|
81
93
|
*/
|
|
Binary file
|