@primuslabs/fund-js-sdk 0.1.8 → 0.1.10
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/index.js +10 -9
- package/dist/index.mjs +10 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -80,6 +80,16 @@ var SUPPORTEDCHAINIDSMAP = {
|
|
|
80
80
|
symbol: "BNB"
|
|
81
81
|
},
|
|
82
82
|
contractAddress: "0x1fb86db904caF7c12100EA64024E5dfd7505E484"
|
|
83
|
+
},
|
|
84
|
+
688688: {
|
|
85
|
+
chainId: 688688,
|
|
86
|
+
chainName: "Pharos Testnet",
|
|
87
|
+
nativeCurrency: {
|
|
88
|
+
decimals: 18,
|
|
89
|
+
name: "PHRS",
|
|
90
|
+
symbol: "PHRS"
|
|
91
|
+
},
|
|
92
|
+
contractAddress: "0xD17512B7EC12880Bd94Eca9d774089fF89805F02"
|
|
83
93
|
}
|
|
84
94
|
};
|
|
85
95
|
var NATIVETOKENS = Object.values(SUPPORTEDCHAINIDSMAP).reduce((prev, curr) => {
|
|
@@ -1364,7 +1374,6 @@ var Erc721Contract_default = Erc721Contract;
|
|
|
1364
1374
|
// src/classes/Fund.ts
|
|
1365
1375
|
var { parseUnits, formatUnits } = import_ethers2.ethers.utils;
|
|
1366
1376
|
var Fund = class {
|
|
1367
|
-
_attestLoading;
|
|
1368
1377
|
zkTlsSdk;
|
|
1369
1378
|
fundContract;
|
|
1370
1379
|
provider;
|
|
@@ -1372,7 +1381,6 @@ var Fund = class {
|
|
|
1372
1381
|
chainId;
|
|
1373
1382
|
_dataSourceTemplateMap = DATASOURCETEMPLATESMAP;
|
|
1374
1383
|
constructor() {
|
|
1375
|
-
this._attestLoading = false;
|
|
1376
1384
|
}
|
|
1377
1385
|
getZkTlsSdk() {
|
|
1378
1386
|
return this.zkTlsSdk;
|
|
@@ -1616,11 +1624,7 @@ var Fund = class {
|
|
|
1616
1624
|
async attest(attestParams, genAppSignature, backUrl) {
|
|
1617
1625
|
return new Promise(async (resolve, reject) => {
|
|
1618
1626
|
console.log("this.zkTlsSdk", this.zkTlsSdk);
|
|
1619
|
-
if (this._attestLoading) {
|
|
1620
|
-
return reject(`Under proof!`);
|
|
1621
|
-
}
|
|
1622
1627
|
const { socialPlatform, userIdentifier, address } = attestParams;
|
|
1623
|
-
this._attestLoading = true;
|
|
1624
1628
|
const { id: templateId, field } = this._dataSourceTemplateMap[socialPlatform];
|
|
1625
1629
|
const attRequest = this.zkTlsSdk.generateRequestParams(
|
|
1626
1630
|
templateId,
|
|
@@ -1642,7 +1646,6 @@ var Fund = class {
|
|
|
1642
1646
|
const signParams = attRequest.toJsonString();
|
|
1643
1647
|
const signature = await genAppSignature(signParams);
|
|
1644
1648
|
if (!signature) {
|
|
1645
|
-
this._attestLoading = false;
|
|
1646
1649
|
return reject(`appSignature is empty!`);
|
|
1647
1650
|
}
|
|
1648
1651
|
try {
|
|
@@ -1655,10 +1658,8 @@ var Fund = class {
|
|
|
1655
1658
|
const attestation = await this.zkTlsSdk.startAttestation(
|
|
1656
1659
|
JSON.stringify(formatAttestParams)
|
|
1657
1660
|
);
|
|
1658
|
-
this._attestLoading = false;
|
|
1659
1661
|
return resolve(attestation);
|
|
1660
1662
|
} catch (error) {
|
|
1661
|
-
this._attestLoading = false;
|
|
1662
1663
|
return reject(error);
|
|
1663
1664
|
}
|
|
1664
1665
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -56,6 +56,16 @@ var SUPPORTEDCHAINIDSMAP = {
|
|
|
56
56
|
symbol: "BNB"
|
|
57
57
|
},
|
|
58
58
|
contractAddress: "0x1fb86db904caF7c12100EA64024E5dfd7505E484"
|
|
59
|
+
},
|
|
60
|
+
688688: {
|
|
61
|
+
chainId: 688688,
|
|
62
|
+
chainName: "Pharos Testnet",
|
|
63
|
+
nativeCurrency: {
|
|
64
|
+
decimals: 18,
|
|
65
|
+
name: "PHRS",
|
|
66
|
+
symbol: "PHRS"
|
|
67
|
+
},
|
|
68
|
+
contractAddress: "0xD17512B7EC12880Bd94Eca9d774089fF89805F02"
|
|
59
69
|
}
|
|
60
70
|
};
|
|
61
71
|
var NATIVETOKENS = Object.values(SUPPORTEDCHAINIDSMAP).reduce((prev, curr) => {
|
|
@@ -1340,7 +1350,6 @@ var Erc721Contract_default = Erc721Contract;
|
|
|
1340
1350
|
// src/classes/Fund.ts
|
|
1341
1351
|
var { parseUnits, formatUnits } = ethers2.utils;
|
|
1342
1352
|
var Fund = class {
|
|
1343
|
-
_attestLoading;
|
|
1344
1353
|
zkTlsSdk;
|
|
1345
1354
|
fundContract;
|
|
1346
1355
|
provider;
|
|
@@ -1348,7 +1357,6 @@ var Fund = class {
|
|
|
1348
1357
|
chainId;
|
|
1349
1358
|
_dataSourceTemplateMap = DATASOURCETEMPLATESMAP;
|
|
1350
1359
|
constructor() {
|
|
1351
|
-
this._attestLoading = false;
|
|
1352
1360
|
}
|
|
1353
1361
|
getZkTlsSdk() {
|
|
1354
1362
|
return this.zkTlsSdk;
|
|
@@ -1592,11 +1600,7 @@ var Fund = class {
|
|
|
1592
1600
|
async attest(attestParams, genAppSignature, backUrl) {
|
|
1593
1601
|
return new Promise(async (resolve, reject) => {
|
|
1594
1602
|
console.log("this.zkTlsSdk", this.zkTlsSdk);
|
|
1595
|
-
if (this._attestLoading) {
|
|
1596
|
-
return reject(`Under proof!`);
|
|
1597
|
-
}
|
|
1598
1603
|
const { socialPlatform, userIdentifier, address } = attestParams;
|
|
1599
|
-
this._attestLoading = true;
|
|
1600
1604
|
const { id: templateId, field } = this._dataSourceTemplateMap[socialPlatform];
|
|
1601
1605
|
const attRequest = this.zkTlsSdk.generateRequestParams(
|
|
1602
1606
|
templateId,
|
|
@@ -1618,7 +1622,6 @@ var Fund = class {
|
|
|
1618
1622
|
const signParams = attRequest.toJsonString();
|
|
1619
1623
|
const signature = await genAppSignature(signParams);
|
|
1620
1624
|
if (!signature) {
|
|
1621
|
-
this._attestLoading = false;
|
|
1622
1625
|
return reject(`appSignature is empty!`);
|
|
1623
1626
|
}
|
|
1624
1627
|
try {
|
|
@@ -1631,10 +1634,8 @@ var Fund = class {
|
|
|
1631
1634
|
const attestation = await this.zkTlsSdk.startAttestation(
|
|
1632
1635
|
JSON.stringify(formatAttestParams)
|
|
1633
1636
|
);
|
|
1634
|
-
this._attestLoading = false;
|
|
1635
1637
|
return resolve(attestation);
|
|
1636
1638
|
} catch (error) {
|
|
1637
|
-
this._attestLoading = false;
|
|
1638
1639
|
return reject(error);
|
|
1639
1640
|
}
|
|
1640
1641
|
});
|