@learncard/core 7.0.0 → 7.0.3

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/core.d.ts CHANGED
@@ -14,7 +14,10 @@ declare const UnsignedVCValidator: z.ZodObject<{
14
14
  z.ZodString,
15
15
  z.ZodObject<{
16
16
  id: z.ZodOptional<z.ZodString>;
17
- type: z.ZodOptional<z.ZodArray<z.ZodString, "atleastone">>;
17
+ type: z.ZodUnion<[
18
+ z.ZodString,
19
+ z.ZodOptional<z.ZodArray<z.ZodString, "atleastone">>
20
+ ]>;
18
21
  name: z.ZodOptional<z.ZodString>;
19
22
  url: z.ZodOptional<z.ZodString>;
20
23
  phone: z.ZodOptional<z.ZodString>;
@@ -168,7 +171,7 @@ declare const UnsignedVCValidator: z.ZodObject<{
168
171
  dateOfBirth: z.ZodOptional<z.ZodString>;
169
172
  }, "strip", z.ZodAny, {
170
173
  [x: string]: any;
171
- type?: [
174
+ type?: string | [
172
175
  string,
173
176
  ...string[]
174
177
  ] | undefined;
@@ -225,7 +228,7 @@ declare const UnsignedVCValidator: z.ZodObject<{
225
228
  dateOfBirth?: string | undefined;
226
229
  }, {
227
230
  [x: string]: any;
228
- type?: [
231
+ type?: string | [
229
232
  string,
230
233
  ...string[]
231
234
  ] | undefined;
@@ -360,7 +363,7 @@ declare const UnsignedVCValidator: z.ZodObject<{
360
363
  "@context": string[];
361
364
  issuer: string | {
362
365
  [x: string]: any;
363
- type?: [
366
+ type?: string | [
364
367
  string,
365
368
  ...string[]
366
369
  ] | undefined;
@@ -448,7 +451,7 @@ declare const UnsignedVCValidator: z.ZodObject<{
448
451
  "@context": string[];
449
452
  issuer: string | {
450
453
  [x: string]: any;
451
- type?: [
454
+ type?: string | [
452
455
  string,
453
456
  ...string[]
454
457
  ] | undefined;
@@ -522,7 +525,10 @@ declare const VCValidator: z.ZodObject<z.extendShape<{
522
525
  z.ZodString,
523
526
  z.ZodObject<{
524
527
  id: z.ZodOptional<z.ZodString>;
525
- type: z.ZodOptional<z.ZodArray<z.ZodString, "atleastone">>;
528
+ type: z.ZodUnion<[
529
+ z.ZodString,
530
+ z.ZodOptional<z.ZodArray<z.ZodString, "atleastone">>
531
+ ]>;
526
532
  name: z.ZodOptional<z.ZodString>;
527
533
  url: z.ZodOptional<z.ZodString>;
528
534
  phone: z.ZodOptional<z.ZodString>;
@@ -676,7 +682,7 @@ declare const VCValidator: z.ZodObject<z.extendShape<{
676
682
  dateOfBirth: z.ZodOptional<z.ZodString>;
677
683
  }, "strip", z.ZodAny, {
678
684
  [x: string]: any;
679
- type?: [
685
+ type?: string | [
680
686
  string,
681
687
  ...string[]
682
688
  ] | undefined;
@@ -733,7 +739,7 @@ declare const VCValidator: z.ZodObject<z.extendShape<{
733
739
  dateOfBirth?: string | undefined;
734
740
  }, {
735
741
  [x: string]: any;
736
- type?: [
742
+ type?: string | [
737
743
  string,
738
744
  ...string[]
739
745
  ] | undefined;
@@ -931,7 +937,7 @@ declare const VCValidator: z.ZodObject<z.extendShape<{
931
937
  "@context": string[];
932
938
  issuer: string | {
933
939
  [x: string]: any;
934
- type?: [
940
+ type?: string | [
935
941
  string,
936
942
  ...string[]
937
943
  ] | undefined;
@@ -1040,7 +1046,7 @@ declare const VCValidator: z.ZodObject<z.extendShape<{
1040
1046
  "@context": string[];
1041
1047
  issuer: string | {
1042
1048
  [x: string]: any;
1043
- type?: [
1049
+ type?: string | [
1044
1050
  string,
1045
1051
  ...string[]
1046
1052
  ] | undefined;
@@ -1140,7 +1146,10 @@ declare const UnsignedVPValidator: z.ZodObject<{
1140
1146
  z.ZodString,
1141
1147
  z.ZodObject<{
1142
1148
  id: z.ZodOptional<z.ZodString>;
1143
- type: z.ZodOptional<z.ZodArray<z.ZodString, "atleastone">>;
1149
+ type: z.ZodUnion<[
1150
+ z.ZodString,
1151
+ z.ZodOptional<z.ZodArray<z.ZodString, "atleastone">>
1152
+ ]>;
1144
1153
  name: z.ZodOptional<z.ZodString>;
1145
1154
  url: z.ZodOptional<z.ZodString>;
1146
1155
  phone: z.ZodOptional<z.ZodString>;
@@ -1294,7 +1303,7 @@ declare const UnsignedVPValidator: z.ZodObject<{
1294
1303
  dateOfBirth: z.ZodOptional<z.ZodString>;
1295
1304
  }, "strip", z.ZodAny, {
1296
1305
  [x: string]: any;
1297
- type?: [
1306
+ type?: string | [
1298
1307
  string,
1299
1308
  ...string[]
1300
1309
  ] | undefined;
@@ -1351,7 +1360,7 @@ declare const UnsignedVPValidator: z.ZodObject<{
1351
1360
  dateOfBirth?: string | undefined;
1352
1361
  }, {
1353
1362
  [x: string]: any;
1354
- type?: [
1363
+ type?: string | [
1355
1364
  string,
1356
1365
  ...string[]
1357
1366
  ] | undefined;
@@ -1549,7 +1558,7 @@ declare const UnsignedVPValidator: z.ZodObject<{
1549
1558
  "@context": string[];
1550
1559
  issuer: string | {
1551
1560
  [x: string]: any;
1552
- type?: [
1561
+ type?: string | [
1553
1562
  string,
1554
1563
  ...string[]
1555
1564
  ] | undefined;
@@ -1658,7 +1667,7 @@ declare const UnsignedVPValidator: z.ZodObject<{
1658
1667
  "@context": string[];
1659
1668
  issuer: string | {
1660
1669
  [x: string]: any;
1661
- type?: [
1670
+ type?: string | [
1662
1671
  string,
1663
1672
  ...string[]
1664
1673
  ] | undefined;
@@ -1752,7 +1761,10 @@ declare const UnsignedVPValidator: z.ZodObject<{
1752
1761
  z.ZodString,
1753
1762
  z.ZodObject<{
1754
1763
  id: z.ZodOptional<z.ZodString>;
1755
- type: z.ZodOptional<z.ZodArray<z.ZodString, "atleastone">>;
1764
+ type: z.ZodUnion<[
1765
+ z.ZodString,
1766
+ z.ZodOptional<z.ZodArray<z.ZodString, "atleastone">>
1767
+ ]>;
1756
1768
  name: z.ZodOptional<z.ZodString>;
1757
1769
  url: z.ZodOptional<z.ZodString>;
1758
1770
  phone: z.ZodOptional<z.ZodString>;
@@ -1906,7 +1918,7 @@ declare const UnsignedVPValidator: z.ZodObject<{
1906
1918
  dateOfBirth: z.ZodOptional<z.ZodString>;
1907
1919
  }, "strip", z.ZodAny, {
1908
1920
  [x: string]: any;
1909
- type?: [
1921
+ type?: string | [
1910
1922
  string,
1911
1923
  ...string[]
1912
1924
  ] | undefined;
@@ -1963,7 +1975,7 @@ declare const UnsignedVPValidator: z.ZodObject<{
1963
1975
  dateOfBirth?: string | undefined;
1964
1976
  }, {
1965
1977
  [x: string]: any;
1966
- type?: [
1978
+ type?: string | [
1967
1979
  string,
1968
1980
  ...string[]
1969
1981
  ] | undefined;
@@ -2161,7 +2173,7 @@ declare const UnsignedVPValidator: z.ZodObject<{
2161
2173
  "@context": string[];
2162
2174
  issuer: string | {
2163
2175
  [x: string]: any;
2164
- type?: [
2176
+ type?: string | [
2165
2177
  string,
2166
2178
  ...string[]
2167
2179
  ] | undefined;
@@ -2270,7 +2282,7 @@ declare const UnsignedVPValidator: z.ZodObject<{
2270
2282
  "@context": string[];
2271
2283
  issuer: string | {
2272
2284
  [x: string]: any;
2273
- type?: [
2285
+ type?: string | [
2274
2286
  string,
2275
2287
  ...string[]
2276
2288
  ] | undefined;
@@ -2391,7 +2403,7 @@ declare const UnsignedVPValidator: z.ZodObject<{
2391
2403
  "@context": string[];
2392
2404
  issuer: string | {
2393
2405
  [x: string]: any;
2394
- type?: [
2406
+ type?: string | [
2395
2407
  string,
2396
2408
  ...string[]
2397
2409
  ] | undefined;
@@ -2500,7 +2512,7 @@ declare const UnsignedVPValidator: z.ZodObject<{
2500
2512
  "@context": string[];
2501
2513
  issuer: string | {
2502
2514
  [x: string]: any;
2503
- type?: [
2515
+ type?: string | [
2504
2516
  string,
2505
2517
  ...string[]
2506
2518
  ] | undefined;
@@ -2619,7 +2631,7 @@ declare const UnsignedVPValidator: z.ZodObject<{
2619
2631
  "@context": string[];
2620
2632
  issuer: string | {
2621
2633
  [x: string]: any;
2622
- type?: [
2634
+ type?: string | [
2623
2635
  string,
2624
2636
  ...string[]
2625
2637
  ] | undefined;
@@ -2728,7 +2740,7 @@ declare const UnsignedVPValidator: z.ZodObject<{
2728
2740
  "@context": string[];
2729
2741
  issuer: string | {
2730
2742
  [x: string]: any;
2731
- type?: [
2743
+ type?: string | [
2732
2744
  string,
2733
2745
  ...string[]
2734
2746
  ] | undefined;
@@ -2829,7 +2841,10 @@ declare const VPValidator: z.ZodObject<z.extendShape<{
2829
2841
  z.ZodString,
2830
2842
  z.ZodObject<{
2831
2843
  id: z.ZodOptional<z.ZodString>;
2832
- type: z.ZodOptional<z.ZodArray<z.ZodString, "atleastone">>;
2844
+ type: z.ZodUnion<[
2845
+ z.ZodString,
2846
+ z.ZodOptional<z.ZodArray<z.ZodString, "atleastone">>
2847
+ ]>;
2833
2848
  name: z.ZodOptional<z.ZodString>;
2834
2849
  url: z.ZodOptional<z.ZodString>;
2835
2850
  phone: z.ZodOptional<z.ZodString>;
@@ -2983,7 +2998,7 @@ declare const VPValidator: z.ZodObject<z.extendShape<{
2983
2998
  dateOfBirth: z.ZodOptional<z.ZodString>;
2984
2999
  }, "strip", z.ZodAny, {
2985
3000
  [x: string]: any;
2986
- type?: [
3001
+ type?: string | [
2987
3002
  string,
2988
3003
  ...string[]
2989
3004
  ] | undefined;
@@ -3040,7 +3055,7 @@ declare const VPValidator: z.ZodObject<z.extendShape<{
3040
3055
  dateOfBirth?: string | undefined;
3041
3056
  }, {
3042
3057
  [x: string]: any;
3043
- type?: [
3058
+ type?: string | [
3044
3059
  string,
3045
3060
  ...string[]
3046
3061
  ] | undefined;
@@ -3238,7 +3253,7 @@ declare const VPValidator: z.ZodObject<z.extendShape<{
3238
3253
  "@context": string[];
3239
3254
  issuer: string | {
3240
3255
  [x: string]: any;
3241
- type?: [
3256
+ type?: string | [
3242
3257
  string,
3243
3258
  ...string[]
3244
3259
  ] | undefined;
@@ -3347,7 +3362,7 @@ declare const VPValidator: z.ZodObject<z.extendShape<{
3347
3362
  "@context": string[];
3348
3363
  issuer: string | {
3349
3364
  [x: string]: any;
3350
- type?: [
3365
+ type?: string | [
3351
3366
  string,
3352
3367
  ...string[]
3353
3368
  ] | undefined;
@@ -3441,7 +3456,10 @@ declare const VPValidator: z.ZodObject<z.extendShape<{
3441
3456
  z.ZodString,
3442
3457
  z.ZodObject<{
3443
3458
  id: z.ZodOptional<z.ZodString>;
3444
- type: z.ZodOptional<z.ZodArray<z.ZodString, "atleastone">>;
3459
+ type: z.ZodUnion<[
3460
+ z.ZodString,
3461
+ z.ZodOptional<z.ZodArray<z.ZodString, "atleastone">>
3462
+ ]>;
3445
3463
  name: z.ZodOptional<z.ZodString>;
3446
3464
  url: z.ZodOptional<z.ZodString>;
3447
3465
  phone: z.ZodOptional<z.ZodString>;
@@ -3595,7 +3613,7 @@ declare const VPValidator: z.ZodObject<z.extendShape<{
3595
3613
  dateOfBirth: z.ZodOptional<z.ZodString>;
3596
3614
  }, "strip", z.ZodAny, {
3597
3615
  [x: string]: any;
3598
- type?: [
3616
+ type?: string | [
3599
3617
  string,
3600
3618
  ...string[]
3601
3619
  ] | undefined;
@@ -3652,7 +3670,7 @@ declare const VPValidator: z.ZodObject<z.extendShape<{
3652
3670
  dateOfBirth?: string | undefined;
3653
3671
  }, {
3654
3672
  [x: string]: any;
3655
- type?: [
3673
+ type?: string | [
3656
3674
  string,
3657
3675
  ...string[]
3658
3676
  ] | undefined;
@@ -3850,7 +3868,7 @@ declare const VPValidator: z.ZodObject<z.extendShape<{
3850
3868
  "@context": string[];
3851
3869
  issuer: string | {
3852
3870
  [x: string]: any;
3853
- type?: [
3871
+ type?: string | [
3854
3872
  string,
3855
3873
  ...string[]
3856
3874
  ] | undefined;
@@ -3959,7 +3977,7 @@ declare const VPValidator: z.ZodObject<z.extendShape<{
3959
3977
  "@context": string[];
3960
3978
  issuer: string | {
3961
3979
  [x: string]: any;
3962
- type?: [
3980
+ type?: string | [
3963
3981
  string,
3964
3982
  ...string[]
3965
3983
  ] | undefined;
@@ -4164,7 +4182,7 @@ declare const VPValidator: z.ZodObject<z.extendShape<{
4164
4182
  "@context": string[];
4165
4183
  issuer: string | {
4166
4184
  [x: string]: any;
4167
- type?: [
4185
+ type?: string | [
4168
4186
  string,
4169
4187
  ...string[]
4170
4188
  ] | undefined;
@@ -4273,7 +4291,7 @@ declare const VPValidator: z.ZodObject<z.extendShape<{
4273
4291
  "@context": string[];
4274
4292
  issuer: string | {
4275
4293
  [x: string]: any;
4276
- type?: [
4294
+ type?: string | [
4277
4295
  string,
4278
4296
  ...string[]
4279
4297
  ] | undefined;
@@ -4413,7 +4431,7 @@ declare const VPValidator: z.ZodObject<z.extendShape<{
4413
4431
  "@context": string[];
4414
4432
  issuer: string | {
4415
4433
  [x: string]: any;
4416
- type?: [
4434
+ type?: string | [
4417
4435
  string,
4418
4436
  ...string[]
4419
4437
  ] | undefined;
@@ -4522,7 +4540,7 @@ declare const VPValidator: z.ZodObject<z.extendShape<{
4522
4540
  "@context": string[];
4523
4541
  issuer: string | {
4524
4542
  [x: string]: any;
4525
- type?: [
4543
+ type?: string | [
4526
4544
  string,
4527
4545
  ...string[]
4528
4546
  ] | undefined;
@@ -4723,6 +4741,7 @@ export declare type EthereumPluginMethods = {
4723
4741
  getBalance: (symbolOrAddress?: string) => Promise<string>;
4724
4742
  getBalanceForAddress: (walletAddress: string, symbolOrAddress?: string) => Promise<string>;
4725
4743
  transferTokens: (tokenSymbolOrAddress: string, amount: number, toAddress: string) => Promise<string>;
4744
+ getGasPrice: () => Promise<string>;
4726
4745
  getCurrentNetwork: () => providers.Networkish;
4727
4746
  changeNetwork: (network: providers.Networkish) => void;
4728
4747
  addInfuraProjectId: (infuraProjectIdToAdd: string) => void;
@@ -5210,6 +5229,12 @@ export declare type GetBalanceForAddress = (walletAddress: string, symbolOrAddre
5210
5229
  * @group LearnCard Methods
5211
5230
  */
5212
5231
  export declare type TransferTokens = (tokenSymbolOrAddress: string, amount: number, toAddress: string) => Promise<string>;
5232
+ /**
5233
+ * Get the gas price of the current network
5234
+ *
5235
+ * @group LearnCard Methods
5236
+ */
5237
+ export declare type GetGasPrice = () => Promise<string>;
5213
5238
  /**
5214
5239
  * Get your current Ethereum network
5215
5240
  *
@@ -5307,6 +5332,7 @@ export declare type AllLearnCardMethods = {
5307
5332
  getBalance: GetBalance;
5308
5333
  getBalanceForAddress: GetBalanceForAddress;
5309
5334
  transferTokens: TransferTokens;
5335
+ getGasPrice: GetGasPrice;
5310
5336
  getCurrentNetwork: GetCurrentNetwork;
5311
5337
  changeNetwork: ChangeNetwork;
5312
5338
  addInfuraProjectId: AddInfuraProjectId;
package/dist/core.esm.js CHANGED
@@ -42103,7 +42103,7 @@ var IdentifierEntryValidator = mod.object({
42103
42103
  });
42104
42104
  var ProfileValidator = mod.string().or(mod.object({
42105
42105
  id: mod.string().optional(),
42106
- type: mod.string().array().nonempty().optional(),
42106
+ type: mod.string().or(mod.string().array().nonempty().optional()),
42107
42107
  name: mod.string().optional(),
42108
42108
  url: mod.string().optional(),
42109
42109
  phone: mod.string().optional(),
@@ -56911,7 +56911,8 @@ var issueCredential2 = /* @__PURE__ */ __name((initWallet) => {
56911
56911
  throw new Error("Cannot issue credential: Could not get subject keypair");
56912
56912
  const options = __spreadValues({
56913
56913
  verificationMethod: yield initWallet.pluginMethods.keyToVerificationMethod("key", kp),
56914
- proofPurpose: "assertionMethod"
56914
+ proofPurpose: "assertionMethod",
56915
+ type: "Ed25519Signature2020"
56915
56916
  }, signingOptions);
56916
56917
  return initWallet.pluginMethods.issueCredential(credential, options, kp);
56917
56918
  });
@@ -56932,7 +56933,8 @@ var issuePresentation2 = /* @__PURE__ */ __name((initWallet) => {
56932
56933
  throw new Error("Cannot issue credential: Could not get subject keypair");
56933
56934
  const options = __spreadValues({
56934
56935
  verificationMethod: yield initWallet.pluginMethods.keyToVerificationMethod("key", kp),
56935
- proofPurpose: "assertionMethod"
56936
+ proofPurpose: "assertionMethod",
56937
+ type: "Ed25519Signature2020"
56936
56938
  }, signingOptions);
56937
56939
  return initWallet.pluginMethods.issuePresentation(presentation, options, kp);
56938
56940
  });
@@ -57112,6 +57114,9 @@ var getEthereumPlugin = /* @__PURE__ */ __name((initWallet, config2) => {
57112
57114
  const tokenContract = new ethers2.Contract(tokenAddress, ERC20ABI, ethersWallet);
57113
57115
  return (yield tokenContract.transfer(toAddress, yield parseUnits(amount.toString(), tokenContract.address, defaultTokenList, yield getChainIdFromProvider(provider)))).hash;
57114
57116
  }),
57117
+ getGasPrice: () => __async(void 0, null, function* () {
57118
+ return ethers2.utils.formatUnits(yield provider.getGasPrice());
57119
+ }),
57115
57120
  getCurrentNetwork: () => {
57116
57121
  return network;
57117
57122
  },
@@ -60378,6 +60383,7 @@ var walletFromKey = /* @__PURE__ */ __name((_0, ..._1) => __async(void 0, [_0, .
60378
60383
  getBalance: wallet.pluginMethods.getBalance,
60379
60384
  getBalanceForAddress: wallet.pluginMethods.getBalanceForAddress,
60380
60385
  transferTokens: wallet.pluginMethods.transferTokens,
60386
+ getGasPrice: wallet.pluginMethods.getGasPrice,
60381
60387
  getCurrentNetwork: wallet.pluginMethods.getCurrentNetwork,
60382
60388
  changeNetwork: wallet.pluginMethods.changeNetwork,
60383
60389
  addInfuraProjectId: wallet.pluginMethods.addInfuraProjectId,