@imtbl/toolkit 2.1.10-alpha.2 → 2.1.11-alpha.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/dist/browser/index.js +4 -3
- package/dist/node/index.cjs +8 -7
- package/dist/node/index.js +4 -3
- package/package.json +4 -4
package/dist/browser/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import i from 'bn.js';
|
|
2
|
-
import * as
|
|
2
|
+
import * as r from 'enc-utils';
|
|
3
|
+
import { toUtf8Bytes } from 'ethers';
|
|
3
4
|
|
|
4
|
-
function
|
|
5
|
+
function d(e){return r.addHexPrefix(r.padLeft(e.r.toString(16),64)+r.padLeft(e.s.toString(16),64)+r.padLeft(e.recoveryParam?.toString(16)||"",2))}function c(e){let t=new i(e,16).cmp(new i(27))!==-1?new i(e,16).sub(new i(27)).toNumber():new i(e,16).toNumber();return e.trim()?t:void 0}function m(e,t=64){let n=r.removeHexPrefix(e);return {r:new i(n.substring(0,t),"hex"),s:new i(n.substring(t,t*2),"hex"),recoveryParam:c(n.substring(t*2,t*2+2))}}async function g(e,t){console.log("signRaw.payload",{payload:e}),console.log("signRaw.toUtf8Bytes",{toUtf8Bytes:toUtf8Bytes(e).toString()});let n=m(await t.signMessage(toUtf8Bytes(e)));return d(n)}async function S(e){let t=Math.floor(Date.now()/1e3).toString(),n=await g(t,e);return {timestamp:t,signature:n}}async function w(e,t){let n=await t.getAddress(),u=await g(e,t);return {message:e,ethAddress:n,ethSignature:u}}function h(e){switch(e.type){case"ERC721":return {type:"ERC721",data:{token_id:e.tokenId,token_address:e.tokenAddress}};case"ERC20":return {type:"ERC20",data:{token_address:e.tokenAddress}};case"ETH":default:return {type:"ETH",data:{decimals:18}}}}
|
|
5
6
|
|
|
6
|
-
export {
|
|
7
|
+
export { h as convertToSignableToken, S as generateIMXAuthorisationHeaders, w as signMessage, g as signRaw };
|
package/dist/node/index.cjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var i = require('bn.js');
|
|
4
|
-
var
|
|
4
|
+
var r = require('enc-utils');
|
|
5
|
+
var ethers = require('ethers');
|
|
5
6
|
|
|
6
7
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
8
|
|
|
@@ -24,11 +25,11 @@ function _interopNamespace(e) {
|
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
var i__default = /*#__PURE__*/_interopDefault(i);
|
|
27
|
-
var
|
|
28
|
+
var r__namespace = /*#__PURE__*/_interopNamespace(r);
|
|
28
29
|
|
|
29
|
-
function
|
|
30
|
+
function g(e){return r__namespace.addHexPrefix(r__namespace.padLeft(e.r.toString(16),64)+r__namespace.padLeft(e.s.toString(16),64)+r__namespace.padLeft(e.recoveryParam?.toString(16)||"",2))}function u(e){let t=new i__default.default(e,16).cmp(new i__default.default(27))!==-1?new i__default.default(e,16).sub(new i__default.default(27)).toNumber():new i__default.default(e,16).toNumber();return e.trim()?t:void 0}function d(e,t=64){let n=r__namespace.removeHexPrefix(e);return {r:new i__default.default(n.substring(0,t),"hex"),s:new i__default.default(n.substring(t,t*2),"hex"),recoveryParam:u(n.substring(t*2,t*2+2))}}async function o(e,t){console.log("signRaw.payload",{payload:e}),console.log("signRaw.toUtf8Bytes",{toUtf8Bytes:ethers.toUtf8Bytes(e).toString()});let n=d(await t.signMessage(ethers.toUtf8Bytes(e)));return g(n)}async function p(e){let t=Math.floor(Date.now()/1e3).toString(),n=await o(t,e);return {timestamp:t,signature:n}}async function l(e,t){let n=await t.getAddress(),a=await o(e,t);return {message:e,ethAddress:n,ethSignature:a}}function w(e){switch(e.type){case"ERC721":return {type:"ERC721",data:{token_id:e.tokenId,token_address:e.tokenAddress}};case"ERC20":return {type:"ERC20",data:{token_address:e.tokenAddress}};case"ETH":default:return {type:"ETH",data:{decimals:18}}}}
|
|
30
31
|
|
|
31
|
-
exports.convertToSignableToken =
|
|
32
|
-
exports.generateIMXAuthorisationHeaders =
|
|
33
|
-
exports.signMessage =
|
|
34
|
-
exports.signRaw =
|
|
32
|
+
exports.convertToSignableToken = w;
|
|
33
|
+
exports.generateIMXAuthorisationHeaders = p;
|
|
34
|
+
exports.signMessage = l;
|
|
35
|
+
exports.signRaw = o;
|
package/dist/node/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import i from 'bn.js';
|
|
2
|
-
import * as
|
|
2
|
+
import * as r from 'enc-utils';
|
|
3
|
+
import { toUtf8Bytes } from 'ethers';
|
|
3
4
|
|
|
4
|
-
function
|
|
5
|
+
function g(e){return r.addHexPrefix(r.padLeft(e.r.toString(16),64)+r.padLeft(e.s.toString(16),64)+r.padLeft(e.recoveryParam?.toString(16)||"",2))}function u(e){let t=new i(e,16).cmp(new i(27))!==-1?new i(e,16).sub(new i(27)).toNumber():new i(e,16).toNumber();return e.trim()?t:void 0}function d(e,t=64){let n=r.removeHexPrefix(e);return {r:new i(n.substring(0,t),"hex"),s:new i(n.substring(t,t*2),"hex"),recoveryParam:u(n.substring(t*2,t*2+2))}}async function o(e,t){console.log("signRaw.payload",{payload:e}),console.log("signRaw.toUtf8Bytes",{toUtf8Bytes:toUtf8Bytes(e).toString()});let n=d(await t.signMessage(toUtf8Bytes(e)));return g(n)}async function p(e){let t=Math.floor(Date.now()/1e3).toString(),n=await o(t,e);return {timestamp:t,signature:n}}async function l(e,t){let n=await t.getAddress(),a=await o(e,t);return {message:e,ethAddress:n,ethSignature:a}}function w(e){switch(e.type){case"ERC721":return {type:"ERC721",data:{token_id:e.tokenId,token_address:e.tokenAddress}};case"ERC20":return {type:"ERC20",data:{token_address:e.tokenAddress}};case"ETH":default:return {type:"ETH",data:{decimals:18}}}}
|
|
5
6
|
|
|
6
|
-
export {
|
|
7
|
+
export { w as convertToSignableToken, p as generateIMXAuthorisationHeaders, l as signMessage, o as signRaw };
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@imtbl/toolkit",
|
|
3
3
|
"description": "Provider package for Immutable SDK",
|
|
4
|
-
"version": "2.1.
|
|
4
|
+
"version": "2.1.11-alpha.0",
|
|
5
5
|
"author": "Immutable",
|
|
6
6
|
"bugs": "https://github.com/immutable/ts-immutable-sdk/issues",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@imtbl/x-client": "2.1.
|
|
9
|
-
"@magic-ext/oidc": "12.0.
|
|
8
|
+
"@imtbl/x-client": "2.1.11-alpha.0",
|
|
9
|
+
"@magic-ext/oidc": "12.0.0",
|
|
10
10
|
"@metamask/detect-provider": "^2.0.0",
|
|
11
11
|
"axios": "^1.6.5",
|
|
12
12
|
"bn.js": "^5.2.1",
|
|
13
13
|
"enc-utils": "^3.0.0",
|
|
14
14
|
"ethers": "^6.13.4",
|
|
15
|
-
"magic-sdk": "^29.0.
|
|
15
|
+
"magic-sdk": "^29.0.0",
|
|
16
16
|
"oidc-client-ts": "2.4.0"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|