@ic-pay/icpay-sdk 1.3.64 → 1.3.65
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/utils.d.ts +0 -6
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +0 -21
- package/dist/utils.js.map +1 -1
- package/package.json +1 -2
package/dist/utils.d.ts
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import { Principal } from '@dfinity/principal';
|
|
2
|
-
/**
|
|
3
|
-
* Convert a Principal (and optional subaccount) to an ICP AccountIdentifier (28 bytes)
|
|
4
|
-
* See: https://internetcomputer.org/docs/current/developer-docs/integrations/ledger/account-identifier/
|
|
5
|
-
*/
|
|
6
|
-
export declare function toAccountIdentifier(principal: Principal, subaccount?: Uint8Array): Uint8Array;
|
|
7
1
|
/**
|
|
8
2
|
* Debug logger utility
|
|
9
3
|
* Only outputs console.log messages when debug is enabled
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,IAAI,CAQ1E"}
|
package/dist/utils.js
CHANGED
|
@@ -1,27 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toAccountIdentifier = toAccountIdentifier;
|
|
4
3
|
exports.debugLog = debugLog;
|
|
5
|
-
const crypto_1 = require("crypto");
|
|
6
|
-
/**
|
|
7
|
-
* Convert a Principal (and optional subaccount) to an ICP AccountIdentifier (28 bytes)
|
|
8
|
-
* See: https://internetcomputer.org/docs/current/developer-docs/integrations/ledger/account-identifier/
|
|
9
|
-
*/
|
|
10
|
-
function toAccountIdentifier(principal, subaccount) {
|
|
11
|
-
// AccountIdentifier = sha224(0x0A + principal.toUint8Array() + subaccount (32 bytes))
|
|
12
|
-
const padding = Buffer.from([0x0A]);
|
|
13
|
-
const principalBytes = Buffer.from(principal.toUint8Array());
|
|
14
|
-
let subaccountBytes;
|
|
15
|
-
if (subaccount && subaccount.length === 32) {
|
|
16
|
-
subaccountBytes = Buffer.from(subaccount);
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
subaccountBytes = Buffer.alloc(32);
|
|
20
|
-
}
|
|
21
|
-
const data = Buffer.concat([padding, principalBytes, subaccountBytes]);
|
|
22
|
-
const hash = (0, crypto_1.createHash)('sha224').update(data).digest();
|
|
23
|
-
return hash;
|
|
24
|
-
}
|
|
25
4
|
/**
|
|
26
5
|
* Debug logger utility
|
|
27
6
|
* Only outputs console.log messages when debug is enabled
|
package/dist/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;AAOA,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;AAOA,4BAQC;AAfD;;;;;;GAMG;AACH,SAAgB,QAAQ,CAAC,KAAc,EAAE,OAAe,EAAE,IAAU;IAClE,IAAI,KAAK,EAAE,CAAC;QACV,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,OAAO,CAAC,GAAG,CAAC,eAAe,OAAO,EAAE,EAAE,IAAI,CAAC,CAAC;QAC9C,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,eAAe,OAAO,EAAE,CAAC,CAAC;QACxC,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ic-pay/icpay-sdk",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.65",
|
|
4
4
|
"description": "Official icpay SDK for Internet Computer payments",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -31,7 +31,6 @@
|
|
|
31
31
|
"@dfinity/identity": "^2.4.1",
|
|
32
32
|
"@dfinity/ledger-icp": "^3.0.0",
|
|
33
33
|
"@dfinity/principal": "^2.4.1",
|
|
34
|
-
"@dfinity/sns": "^3.7.0",
|
|
35
34
|
"axios": "^1.6.0"
|
|
36
35
|
},
|
|
37
36
|
"devDependencies": {
|