@coinbase/cdp-core 0.0.35 → 0.0.37
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 +52 -8
- package/dist/esm/index.native.js +38 -36
- package/dist/esm/index.native100.js +117 -41
- package/dist/esm/index.native101.js +77 -16
- package/dist/esm/index.native102.js +9 -27
- package/dist/esm/index.native103.js +5 -8
- package/dist/esm/index.native104.js +18 -11
- package/dist/esm/index.native105.js +28 -13
- package/dist/esm/index.native106.js +8 -10
- package/dist/esm/index.native107.js +11 -17
- package/dist/esm/index.native108.js +12 -80
- package/dist/esm/index.native109.js +8 -77
- package/dist/esm/index.native110.js +19 -0
- package/dist/esm/index.native111.js +83 -0
- package/dist/esm/index.native112.js +15 -0
- package/dist/esm/index.native113.js +38 -0
- package/dist/esm/index.native114.js +44 -0
- package/dist/esm/index.native115.js +81 -0
- package/dist/esm/index.native13.js +3 -9
- package/dist/esm/index.native2.js +4 -5
- package/dist/esm/index.native20.js +13 -13
- package/dist/esm/index.native21.js +3 -3
- package/dist/esm/index.native24.js +2 -2
- package/dist/esm/index.native25.js +940 -149
- package/dist/esm/index.native26.js +2 -48
- package/dist/esm/index.native27.js +43 -243
- package/dist/esm/index.native28.js +27 -55
- package/dist/esm/index.native29.js +158 -15
- package/dist/esm/index.native30.js +46 -21
- package/dist/esm/index.native31.js +243 -44
- package/dist/esm/index.native32.js +56 -9
- package/dist/esm/index.native33.js +15 -16
- package/dist/esm/index.native34.js +19 -42
- package/dist/esm/index.native35.js +50 -13
- package/dist/esm/index.native36.js +2 -56
- package/dist/esm/index.native37.js +2 -7
- package/dist/esm/index.native38.js +8 -21
- package/dist/esm/index.native39.js +17 -11
- package/dist/esm/index.native40.js +45 -3
- package/dist/esm/index.native41.js +13 -3
- package/dist/esm/index.native42.js +52 -31
- package/dist/esm/index.native43.js +6 -12
- package/dist/esm/index.native44.js +21 -4
- package/dist/esm/index.native45.js +11 -28
- package/dist/esm/index.native46.js +3 -6
- package/dist/esm/index.native47.js +3 -24
- package/dist/esm/index.native48.js +34 -16
- package/dist/esm/index.native49.js +11 -53
- package/dist/esm/index.native50.js +4 -23
- package/dist/esm/index.native51.js +28 -11
- package/dist/esm/index.native52.js +6 -27
- package/dist/esm/index.native53.js +22 -40
- package/dist/esm/index.native54.js +16 -55
- package/dist/esm/index.native55.js +53 -126
- package/dist/esm/index.native56.js +22 -11
- package/dist/esm/index.native57.js +11 -104
- package/dist/esm/index.native58.js +27 -6
- package/dist/esm/index.native59.js +43 -3
- package/dist/esm/index.native6.js +236 -199
- package/dist/esm/index.native60.js +55 -14
- package/dist/esm/index.native61.js +126 -41
- package/dist/esm/index.native62.js +10 -76
- package/dist/esm/index.native63.js +105 -2
- package/dist/esm/index.native64.js +7 -2
- package/dist/esm/index.native65.js +3 -13
- package/dist/esm/index.native66.js +14 -37
- package/dist/esm/index.native67.js +41 -5
- package/dist/esm/index.native68.js +76 -32
- package/dist/esm/index.native69.js +2 -9
- package/dist/esm/index.native70.js +2 -11
- package/dist/esm/index.native71.js +12 -11
- package/dist/esm/index.native72.js +36 -12
- package/dist/esm/index.native73.js +5 -17
- package/dist/esm/index.native74.js +34 -5
- package/dist/esm/index.native75.js +9 -5
- package/dist/esm/index.native76.js +10 -10
- package/dist/esm/index.native77.js +11 -54
- package/dist/esm/index.native78.js +13 -10
- package/dist/esm/index.native79.js +19 -2
- package/dist/esm/index.native8.js +48 -48
- package/dist/esm/index.native80.js +6 -45
- package/dist/esm/index.native81.js +4 -13
- package/dist/esm/index.native82.js +11 -2
- package/dist/esm/index.native83.js +51 -17
- package/dist/esm/index.native84.js +10 -19
- package/dist/esm/index.native85.js +2 -80
- package/dist/esm/index.native86.js +44 -103
- package/dist/esm/index.native87.js +13 -32
- package/dist/esm/index.native88.js +2 -7
- package/dist/esm/index.native89.js +21 -10
- package/dist/esm/index.native90.js +18 -19
- package/dist/esm/index.native91.js +80 -10
- package/dist/esm/index.native92.js +101 -17
- package/dist/esm/index.native93.js +30 -91
- package/dist/esm/index.native94.js +7 -21
- package/dist/esm/index.native95.js +20 -117
- package/dist/esm/index.native96.js +10 -79
- package/dist/esm/index.native97.js +20 -5
- package/dist/esm/index.native98.js +92 -11
- package/dist/esm/index.native99.js +20 -35
- package/dist/esm/index.web.js +35 -33
- package/dist/esm/index.web100.js +6 -12
- package/dist/esm/index.web101.js +10 -10
- package/dist/esm/index.web102.js +15 -14
- package/dist/esm/index.web103.js +25 -78
- package/dist/esm/index.web104.js +6 -11
- package/dist/esm/index.web105.js +10 -35
- package/dist/esm/index.web106.js +11 -40
- package/dist/esm/index.web107.js +8 -77
- package/dist/esm/index.web108.js +19 -0
- package/dist/esm/index.web109.js +83 -0
- package/dist/esm/index.web110.js +7 -0
- package/dist/esm/index.web111.js +15 -0
- package/dist/esm/index.web112.js +38 -0
- package/dist/esm/index.web113.js +44 -0
- package/dist/esm/index.web114.js +81 -0
- package/dist/esm/index.web12.js +3 -16
- package/dist/esm/index.web13.js +15 -17
- package/dist/esm/index.web14.js +15 -116
- package/dist/esm/index.web15.js +116 -12
- package/dist/esm/index.web16.js +15 -42
- package/dist/esm/index.web17.js +42 -20
- package/dist/esm/index.web18.js +20 -172
- package/dist/esm/index.web19.js +170 -39
- package/dist/esm/index.web20.js +41 -49
- package/dist/esm/index.web21.js +47 -70
- package/dist/esm/index.web22.js +69 -23
- package/dist/esm/index.web23.js +22 -156
- package/dist/esm/index.web24.js +13 -44
- package/dist/esm/index.web25.js +18 -245
- package/dist/esm/index.web26.js +51 -56
- package/dist/esm/index.web27.js +158 -15
- package/dist/esm/index.web28.js +46 -21
- package/dist/esm/index.web29.js +243 -44
- package/dist/esm/index.web3.js +7 -7
- package/dist/esm/index.web30.js +56 -9
- package/dist/esm/index.web31.js +950 -17
- package/dist/esm/index.web32.js +2 -46
- package/dist/esm/index.web33.js +49 -13
- package/dist/esm/index.web34.js +27 -55
- package/dist/esm/index.web35.js +12 -6
- package/dist/esm/index.web36.js +11 -21
- package/dist/esm/index.web37.js +2 -12
- package/dist/esm/index.web38.js +2 -4
- package/dist/esm/index.web39.js +54 -3
- package/dist/esm/index.web40.js +10 -34
- package/dist/esm/index.web41.js +2 -13
- package/dist/esm/index.web42.js +45 -5
- package/dist/esm/index.web43.js +13 -28
- package/dist/esm/index.web44.js +8 -6
- package/dist/esm/index.web45.js +17 -24
- package/dist/esm/index.web46.js +45 -16
- package/dist/esm/index.web47.js +13 -54
- package/dist/esm/index.web48.js +53 -21
- package/dist/esm/index.web49.js +6 -11
- package/dist/esm/index.web5.js +236 -199
- package/dist/esm/index.web50.js +21 -27
- package/dist/esm/index.web51.js +3 -42
- package/dist/esm/index.web52.js +3 -55
- package/dist/esm/index.web53.js +33 -126
- package/dist/esm/index.web54.js +9 -9
- package/dist/esm/index.web55.js +4 -104
- package/dist/esm/index.web56.js +28 -6
- package/dist/esm/index.web57.js +7 -3
- package/dist/esm/index.web58.js +24 -14
- package/dist/esm/index.web59.js +16 -42
- package/dist/esm/index.web6.js +3 -3
- package/dist/esm/index.web60.js +52 -76
- package/dist/esm/index.web61.js +24 -2
- package/dist/esm/index.web62.js +12 -2
- package/dist/esm/index.web63.js +27 -12
- package/dist/esm/index.web64.js +39 -34
- package/dist/esm/index.web65.js +54 -5
- package/dist/esm/index.web66.js +126 -33
- package/dist/esm/index.web67.js +12 -8
- package/dist/esm/index.web68.js +104 -10
- package/dist/esm/index.web69.js +6 -11
- package/dist/esm/index.web7.js +48 -48
- package/dist/esm/index.web70.js +3 -14
- package/dist/esm/index.web71.js +14 -18
- package/dist/esm/index.web72.js +42 -5
- package/dist/esm/index.web73.js +79 -5
- package/dist/esm/index.web74.js +2 -11
- package/dist/esm/index.web75.js +2 -55
- package/dist/esm/index.web76.js +37 -10
- package/dist/esm/index.web77.js +7 -2
- package/dist/esm/index.web78.js +34 -44
- package/dist/esm/index.web79.js +8 -13
- package/dist/esm/index.web80.js +11 -2
- package/dist/esm/index.web81.js +11 -20
- package/dist/esm/index.web82.js +13 -19
- package/dist/esm/index.web83.js +18 -79
- package/dist/esm/index.web84.js +5 -103
- package/dist/esm/index.web85.js +5 -33
- package/dist/esm/index.web86.js +10 -6
- package/dist/esm/index.web87.js +102 -19
- package/dist/esm/index.web88.js +79 -10
- package/dist/esm/index.web89.js +80 -20
- package/dist/esm/index.web9.js +3 -3
- package/dist/esm/index.web90.js +20 -93
- package/dist/esm/index.web91.js +9 -20
- package/dist/esm/index.web92.js +16 -114
- package/dist/esm/index.web93.js +90 -75
- package/dist/esm/index.web94.js +20 -9
- package/dist/esm/index.web95.js +118 -5
- package/dist/esm/index.web96.js +2 -18
- package/dist/esm/index.web97.js +20 -27
- package/dist/esm/index.web98.js +19 -7
- package/dist/esm/index.web99.js +32 -10
- package/dist/native/index.native.js +38 -36
- package/dist/native/index.native100.js +117 -41
- package/dist/native/index.native101.js +77 -16
- package/dist/native/index.native102.js +9 -27
- package/dist/native/index.native103.js +5 -8
- package/dist/native/index.native104.js +18 -11
- package/dist/native/index.native105.js +28 -13
- package/dist/native/index.native106.js +8 -10
- package/dist/native/index.native107.js +11 -17
- package/dist/native/index.native108.js +12 -80
- package/dist/native/index.native109.js +8 -77
- package/dist/native/index.native110.js +19 -0
- package/dist/native/index.native111.js +83 -0
- package/dist/native/index.native112.js +15 -0
- package/dist/native/index.native113.js +38 -0
- package/dist/native/index.native114.js +44 -0
- package/dist/native/index.native115.js +81 -0
- package/dist/native/index.native13.js +3 -9
- package/dist/native/index.native2.js +4 -5
- package/dist/native/index.native20.js +13 -13
- package/dist/native/index.native21.js +3 -3
- package/dist/native/index.native24.js +2 -2
- package/dist/native/index.native25.js +940 -149
- package/dist/native/index.native26.js +2 -48
- package/dist/native/index.native27.js +43 -243
- package/dist/native/index.native28.js +27 -55
- package/dist/native/index.native29.js +158 -15
- package/dist/native/index.native30.js +46 -21
- package/dist/native/index.native31.js +243 -44
- package/dist/native/index.native32.js +56 -9
- package/dist/native/index.native33.js +15 -16
- package/dist/native/index.native34.js +19 -42
- package/dist/native/index.native35.js +50 -13
- package/dist/native/index.native36.js +2 -56
- package/dist/native/index.native37.js +2 -7
- package/dist/native/index.native38.js +8 -21
- package/dist/native/index.native39.js +17 -11
- package/dist/native/index.native40.js +45 -3
- package/dist/native/index.native41.js +13 -3
- package/dist/native/index.native42.js +52 -31
- package/dist/native/index.native43.js +6 -12
- package/dist/native/index.native44.js +21 -4
- package/dist/native/index.native45.js +11 -28
- package/dist/native/index.native46.js +3 -6
- package/dist/native/index.native47.js +3 -24
- package/dist/native/index.native48.js +34 -16
- package/dist/native/index.native49.js +11 -53
- package/dist/native/index.native50.js +4 -23
- package/dist/native/index.native51.js +28 -11
- package/dist/native/index.native52.js +6 -27
- package/dist/native/index.native53.js +22 -40
- package/dist/native/index.native54.js +16 -55
- package/dist/native/index.native55.js +53 -126
- package/dist/native/index.native56.js +22 -11
- package/dist/native/index.native57.js +11 -104
- package/dist/native/index.native58.js +27 -6
- package/dist/native/index.native59.js +43 -3
- package/dist/native/index.native6.js +236 -199
- package/dist/native/index.native60.js +55 -14
- package/dist/native/index.native61.js +126 -41
- package/dist/native/index.native62.js +10 -76
- package/dist/native/index.native63.js +105 -2
- package/dist/native/index.native64.js +7 -2
- package/dist/native/index.native65.js +3 -13
- package/dist/native/index.native66.js +14 -37
- package/dist/native/index.native67.js +41 -5
- package/dist/native/index.native68.js +76 -32
- package/dist/native/index.native69.js +2 -9
- package/dist/native/index.native70.js +2 -11
- package/dist/native/index.native71.js +12 -11
- package/dist/native/index.native72.js +36 -12
- package/dist/native/index.native73.js +5 -17
- package/dist/native/index.native74.js +34 -5
- package/dist/native/index.native75.js +9 -5
- package/dist/native/index.native76.js +10 -10
- package/dist/native/index.native77.js +11 -54
- package/dist/native/index.native78.js +13 -10
- package/dist/native/index.native79.js +19 -2
- package/dist/native/index.native8.js +48 -48
- package/dist/native/index.native80.js +6 -45
- package/dist/native/index.native81.js +4 -13
- package/dist/native/index.native82.js +11 -2
- package/dist/native/index.native83.js +51 -17
- package/dist/native/index.native84.js +10 -19
- package/dist/native/index.native85.js +2 -80
- package/dist/native/index.native86.js +44 -103
- package/dist/native/index.native87.js +13 -32
- package/dist/native/index.native88.js +2 -7
- package/dist/native/index.native89.js +21 -10
- package/dist/native/index.native90.js +18 -19
- package/dist/native/index.native91.js +80 -10
- package/dist/native/index.native92.js +101 -17
- package/dist/native/index.native93.js +30 -91
- package/dist/native/index.native94.js +7 -21
- package/dist/native/index.native95.js +20 -117
- package/dist/native/index.native96.js +10 -79
- package/dist/native/index.native97.js +20 -5
- package/dist/native/index.native98.js +92 -11
- package/dist/native/index.native99.js +20 -35
- package/dist/native-types/core.d.ts +3 -1
- package/dist/native-types/platform/types.d.ts +1 -1
- package/dist/native-types/types.d.ts +32 -2
- package/dist/types/core.d.ts +3 -1
- package/dist/types/platform/types.d.ts +1 -1
- package/dist/types/types.d.ts +32 -2
- package/dist/web/index.web.js +35 -33
- package/dist/web/index.web100.js +6 -12
- package/dist/web/index.web101.js +10 -10
- package/dist/web/index.web102.js +15 -14
- package/dist/web/index.web103.js +25 -78
- package/dist/web/index.web104.js +6 -11
- package/dist/web/index.web105.js +10 -35
- package/dist/web/index.web106.js +11 -40
- package/dist/web/index.web107.js +8 -77
- package/dist/web/index.web108.js +19 -0
- package/dist/web/index.web109.js +83 -0
- package/dist/web/index.web110.js +7 -0
- package/dist/web/index.web111.js +15 -0
- package/dist/web/index.web112.js +38 -0
- package/dist/web/index.web113.js +44 -0
- package/dist/web/index.web114.js +81 -0
- package/dist/web/index.web12.js +3 -16
- package/dist/web/index.web13.js +15 -17
- package/dist/web/index.web14.js +15 -116
- package/dist/web/index.web15.js +116 -12
- package/dist/web/index.web16.js +15 -42
- package/dist/web/index.web17.js +42 -20
- package/dist/web/index.web18.js +20 -172
- package/dist/web/index.web19.js +170 -39
- package/dist/web/index.web20.js +41 -49
- package/dist/web/index.web21.js +47 -70
- package/dist/web/index.web22.js +69 -23
- package/dist/web/index.web23.js +22 -156
- package/dist/web/index.web24.js +13 -44
- package/dist/web/index.web25.js +18 -245
- package/dist/web/index.web26.js +51 -56
- package/dist/web/index.web27.js +158 -15
- package/dist/web/index.web28.js +46 -21
- package/dist/web/index.web29.js +243 -44
- package/dist/web/index.web3.js +7 -7
- package/dist/web/index.web30.js +56 -9
- package/dist/web/index.web31.js +950 -17
- package/dist/web/index.web32.js +2 -46
- package/dist/web/index.web33.js +49 -13
- package/dist/web/index.web34.js +27 -55
- package/dist/web/index.web35.js +12 -6
- package/dist/web/index.web36.js +11 -21
- package/dist/web/index.web37.js +2 -12
- package/dist/web/index.web38.js +2 -4
- package/dist/web/index.web39.js +54 -3
- package/dist/web/index.web40.js +10 -34
- package/dist/web/index.web41.js +2 -13
- package/dist/web/index.web42.js +45 -5
- package/dist/web/index.web43.js +13 -28
- package/dist/web/index.web44.js +8 -6
- package/dist/web/index.web45.js +17 -24
- package/dist/web/index.web46.js +45 -16
- package/dist/web/index.web47.js +13 -54
- package/dist/web/index.web48.js +53 -21
- package/dist/web/index.web49.js +6 -11
- package/dist/web/index.web5.js +236 -199
- package/dist/web/index.web50.js +21 -27
- package/dist/web/index.web51.js +3 -42
- package/dist/web/index.web52.js +3 -55
- package/dist/web/index.web53.js +33 -126
- package/dist/web/index.web54.js +9 -9
- package/dist/web/index.web55.js +4 -104
- package/dist/web/index.web56.js +28 -6
- package/dist/web/index.web57.js +7 -3
- package/dist/web/index.web58.js +24 -14
- package/dist/web/index.web59.js +16 -42
- package/dist/web/index.web6.js +3 -3
- package/dist/web/index.web60.js +52 -76
- package/dist/web/index.web61.js +24 -2
- package/dist/web/index.web62.js +12 -2
- package/dist/web/index.web63.js +27 -12
- package/dist/web/index.web64.js +39 -34
- package/dist/web/index.web65.js +54 -5
- package/dist/web/index.web66.js +126 -33
- package/dist/web/index.web67.js +12 -8
- package/dist/web/index.web68.js +104 -10
- package/dist/web/index.web69.js +6 -11
- package/dist/web/index.web7.js +48 -48
- package/dist/web/index.web70.js +3 -14
- package/dist/web/index.web71.js +14 -18
- package/dist/web/index.web72.js +42 -5
- package/dist/web/index.web73.js +79 -5
- package/dist/web/index.web74.js +2 -11
- package/dist/web/index.web75.js +2 -55
- package/dist/web/index.web76.js +37 -10
- package/dist/web/index.web77.js +7 -2
- package/dist/web/index.web78.js +34 -44
- package/dist/web/index.web79.js +8 -13
- package/dist/web/index.web80.js +11 -2
- package/dist/web/index.web81.js +11 -20
- package/dist/web/index.web82.js +13 -19
- package/dist/web/index.web83.js +18 -79
- package/dist/web/index.web84.js +5 -103
- package/dist/web/index.web85.js +5 -33
- package/dist/web/index.web86.js +10 -6
- package/dist/web/index.web87.js +102 -19
- package/dist/web/index.web88.js +79 -10
- package/dist/web/index.web89.js +80 -20
- package/dist/web/index.web9.js +3 -3
- package/dist/web/index.web90.js +20 -93
- package/dist/web/index.web91.js +9 -20
- package/dist/web/index.web92.js +16 -114
- package/dist/web/index.web93.js +90 -75
- package/dist/web/index.web94.js +20 -9
- package/dist/web/index.web95.js +118 -5
- package/dist/web/index.web96.js +2 -18
- package/dist/web/index.web97.js +20 -27
- package/dist/web/index.web98.js +19 -7
- package/dist/web/index.web99.js +32 -10
- package/dist/web-types/core.d.ts +3 -1
- package/dist/web-types/platform/types.d.ts +1 -1
- package/dist/web-types/types.d.ts +32 -2
- package/package.json +9 -7
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { BaseError as r } from "./index.native60.js";
|
|
2
|
+
class d extends r {
|
|
3
|
+
constructor({ address: s }) {
|
|
4
|
+
super(`Address "${s}" is invalid.`, {
|
|
5
|
+
metaMessages: [
|
|
6
|
+
"- Address must be a hex value of 20 bytes (40 hex characters).",
|
|
7
|
+
"- Address must match its checksum counterpart."
|
|
8
|
+
],
|
|
9
|
+
name: "InvalidAddressError"
|
|
10
|
+
});
|
|
11
|
+
}
|
|
11
12
|
}
|
|
12
13
|
export {
|
|
13
|
-
|
|
14
|
+
d as InvalidAddressError
|
|
14
15
|
};
|
|
@@ -1,16 +1,40 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
blob: s[o],
|
|
9
|
-
commitment: b[o],
|
|
10
|
-
proof: r[o]
|
|
1
|
+
import { versionedHashVersionKzg as a } from "./index.native69.js";
|
|
2
|
+
import { BaseError as s } from "./index.native60.js";
|
|
3
|
+
class t extends s {
|
|
4
|
+
constructor({ maxSize: e, size: r }) {
|
|
5
|
+
super("Blob size is too large.", {
|
|
6
|
+
metaMessages: [`Max: ${e} bytes`, `Given: ${r} bytes`],
|
|
7
|
+
name: "BlobSizeTooLargeError"
|
|
11
8
|
});
|
|
12
|
-
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
class d extends s {
|
|
12
|
+
constructor() {
|
|
13
|
+
super("Blob data must not be empty.", { name: "EmptyBlobError" });
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
class l extends s {
|
|
17
|
+
constructor({ hash: e, size: r }) {
|
|
18
|
+
super(`Versioned hash "${e}" size is invalid.`, {
|
|
19
|
+
metaMessages: ["Expected: 32", `Received: ${r}`],
|
|
20
|
+
name: "InvalidVersionedHashSizeError"
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
class c extends s {
|
|
25
|
+
constructor({ hash: e, version: r }) {
|
|
26
|
+
super(`Versioned hash "${e}" version is invalid.`, {
|
|
27
|
+
metaMessages: [
|
|
28
|
+
`Expected: ${a}`,
|
|
29
|
+
`Received: ${r}`
|
|
30
|
+
],
|
|
31
|
+
name: "InvalidVersionedHashVersionError"
|
|
32
|
+
});
|
|
33
|
+
}
|
|
13
34
|
}
|
|
14
35
|
export {
|
|
15
|
-
|
|
36
|
+
t as BlobSizeTooLargeError,
|
|
37
|
+
d as EmptyBlobError,
|
|
38
|
+
l as InvalidVersionedHashSizeError,
|
|
39
|
+
c as InvalidVersionedHashVersionError
|
|
16
40
|
};
|
|
@@ -1,21 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (!r || r.length === 0)
|
|
6
|
-
return [];
|
|
7
|
-
const n = [];
|
|
8
|
-
for (let o = 0; o < r.length; o++) {
|
|
9
|
-
const { address: i, storageKeys: e } = r[o];
|
|
10
|
-
for (let t = 0; t < e.length; t++)
|
|
11
|
-
if (e[t].length - 2 !== 64)
|
|
12
|
-
throw new l({ storageKey: e[t] });
|
|
13
|
-
if (!f(i, { strict: !1 }))
|
|
14
|
-
throw new s({ address: i });
|
|
15
|
-
n.push([i, e]);
|
|
1
|
+
import { BaseError as i } from "./index.native60.js";
|
|
2
|
+
class o extends i {
|
|
3
|
+
constructor({ chainId: r }) {
|
|
4
|
+
super(typeof r == "number" ? `Chain ID "${r}" is invalid.` : "Chain ID is invalid.", { name: "InvalidChainIdError" });
|
|
16
5
|
}
|
|
17
|
-
return n;
|
|
18
6
|
}
|
|
19
7
|
export {
|
|
20
|
-
|
|
8
|
+
o as InvalidChainIdError
|
|
21
9
|
};
|
|
@@ -1,8 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { formatGwei as a } from "./index.native80.js";
|
|
2
|
+
import { BaseError as o } from "./index.native60.js";
|
|
3
|
+
class n extends o {
|
|
4
|
+
constructor({ cause: r, maxFeePerGas: e } = {}) {
|
|
5
|
+
super(`The fee cap (\`maxFeePerGas\`${e ? ` = ${a(e)} gwei` : ""}) cannot be higher than the maximum allowed value (2^256-1).`, {
|
|
6
|
+
cause: r,
|
|
7
|
+
name: "FeeCapTooHighError"
|
|
8
|
+
});
|
|
9
|
+
}
|
|
5
10
|
}
|
|
11
|
+
Object.defineProperty(n, "nodeMessage", {
|
|
12
|
+
enumerable: !0,
|
|
13
|
+
configurable: !0,
|
|
14
|
+
writable: !0,
|
|
15
|
+
value: /max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/
|
|
16
|
+
});
|
|
17
|
+
class h extends o {
|
|
18
|
+
constructor({ cause: r, maxPriorityFeePerGas: e, maxFeePerGas: t } = {}) {
|
|
19
|
+
super([
|
|
20
|
+
`The provided tip (\`maxPriorityFeePerGas\`${e ? ` = ${a(e)} gwei` : ""}) cannot be higher than the fee cap (\`maxFeePerGas\`${t ? ` = ${a(t)} gwei` : ""}).`
|
|
21
|
+
].join(`
|
|
22
|
+
`), {
|
|
23
|
+
cause: r,
|
|
24
|
+
name: "TipAboveFeeCapError"
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
Object.defineProperty(h, "nodeMessage", {
|
|
29
|
+
enumerable: !0,
|
|
30
|
+
configurable: !0,
|
|
31
|
+
writable: !0,
|
|
32
|
+
value: /max priority fee per gas higher than max fee per gas|tip higher than fee cap/
|
|
33
|
+
});
|
|
6
34
|
export {
|
|
7
|
-
|
|
35
|
+
n as FeeCapTooHighError,
|
|
36
|
+
h as TipAboveFeeCapError
|
|
8
37
|
};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
1
|
+
import { hexToBytes as i } from "./index.native42.js";
|
|
2
|
+
import { bytesToHex as f } from "./index.native40.js";
|
|
3
|
+
function y(o) {
|
|
4
|
+
const { kzg: s } = o, n = o.to ?? (typeof o.blobs[0] == "string" ? "hex" : "bytes"), m = typeof o.blobs[0] == "string" ? o.blobs.map((t) => i(t)) : o.blobs, b = [];
|
|
5
|
+
for (const t of m)
|
|
6
|
+
b.push(Uint8Array.from(s.blobToKzgCommitment(t)));
|
|
7
|
+
return n === "bytes" ? b : b.map((t) => f(t));
|
|
8
|
+
}
|
|
5
9
|
export {
|
|
6
|
-
|
|
10
|
+
y as blobsToCommitments
|
|
7
11
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
let
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return
|
|
1
|
+
import { hexToBytes as b } from "./index.native42.js";
|
|
2
|
+
import { bytesToHex as y } from "./index.native40.js";
|
|
3
|
+
function h(t) {
|
|
4
|
+
const { kzg: m } = t, c = t.to ?? (typeof t.blobs[0] == "string" ? "hex" : "bytes"), s = typeof t.blobs[0] == "string" ? t.blobs.map((o) => b(o)) : t.blobs, i = typeof t.commitments[0] == "string" ? t.commitments.map((o) => b(o)) : t.commitments, n = [];
|
|
5
|
+
for (let o = 0; o < s.length; o++) {
|
|
6
|
+
const f = s[o], l = i[o];
|
|
7
|
+
n.push(Uint8Array.from(m.computeBlobKzgProof(f, l)));
|
|
8
|
+
}
|
|
9
|
+
return c === "bytes" ? n : n.map((o) => y(o));
|
|
10
10
|
}
|
|
11
11
|
export {
|
|
12
|
-
|
|
12
|
+
h as blobsToProofs
|
|
13
13
|
};
|
|
@@ -1,57 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
#e;
|
|
12
|
-
#t;
|
|
13
|
-
constructor(e) {
|
|
14
|
-
if (!(e instanceof Uint8Array))
|
|
15
|
-
throw new TypeError("payload must be an instance of Uint8Array");
|
|
16
|
-
this.#r = e;
|
|
17
|
-
}
|
|
18
|
-
setProtectedHeader(e) {
|
|
19
|
-
if (this.#e)
|
|
20
|
-
throw new TypeError("setProtectedHeader can only be called once");
|
|
21
|
-
return this.#e = e, this;
|
|
22
|
-
}
|
|
23
|
-
setUnprotectedHeader(e) {
|
|
24
|
-
if (this.#t)
|
|
25
|
-
throw new TypeError("setUnprotectedHeader can only be called once");
|
|
26
|
-
return this.#t = e, this;
|
|
27
|
-
}
|
|
28
|
-
async sign(e, l) {
|
|
29
|
-
if (!this.#e && !this.#t)
|
|
30
|
-
throw new r("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");
|
|
31
|
-
if (!b(this.#e, this.#t))
|
|
32
|
-
throw new r("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
|
|
33
|
-
const c = {
|
|
34
|
-
...this.#e,
|
|
35
|
-
...this.#t
|
|
36
|
-
}, p = H(r, /* @__PURE__ */ new Map([["b64", !0]]), l?.crit, this.#e, c);
|
|
37
|
-
let o = !0;
|
|
38
|
-
if (p.has("b64") && (o = this.#e.b64, typeof o != "boolean"))
|
|
39
|
-
throw new r('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
|
|
40
|
-
const { alg: t } = c;
|
|
41
|
-
if (typeof t != "string" || !t)
|
|
42
|
-
throw new r('JWS "alg" (Algorithm) Header Parameter missing or invalid');
|
|
43
|
-
g(t, e, "sign");
|
|
44
|
-
let i = this.#r;
|
|
45
|
-
o && (i = s.encode(d(i)));
|
|
46
|
-
let n;
|
|
47
|
-
this.#e ? n = s.encode(d(JSON.stringify(this.#e))) : n = s.encode("");
|
|
48
|
-
const f = u(n, s.encode("."), i), m = await P(e, t), w = await y(t, m, f), a = {
|
|
49
|
-
signature: d(w),
|
|
50
|
-
payload: ""
|
|
51
|
-
};
|
|
52
|
-
return o && (a.payload = h.decode(i)), this.#t && (a.header = this.#t), this.#e && (a.protected = h.decode(n)), a;
|
|
53
|
-
}
|
|
1
|
+
import { commitmentToVersionedHash as i } from "./index.native94.js";
|
|
2
|
+
function r(o) {
|
|
3
|
+
const { commitments: t, version: n } = o, e = o.to ?? (typeof t[0] == "string" ? "hex" : "bytes"), s = [];
|
|
4
|
+
for (const m of t)
|
|
5
|
+
s.push(i({
|
|
6
|
+
commitment: m,
|
|
7
|
+
to: e,
|
|
8
|
+
version: n
|
|
9
|
+
}));
|
|
10
|
+
return s;
|
|
54
11
|
}
|
|
55
12
|
export {
|
|
56
|
-
|
|
13
|
+
r as commitmentsToVersionedHashes
|
|
57
14
|
};
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { blobsToCommitments as f } from "./index.native75.js";
|
|
2
|
+
import { blobsToProofs as l } from "./index.native76.js";
|
|
3
|
+
import { toBlobs as p } from "./index.native93.js";
|
|
4
|
+
function k(t) {
|
|
5
|
+
const { data: i, kzg: n, to: m } = t, s = t.blobs ?? p({ data: i, to: m }), b = t.commitments ?? f({ blobs: s, kzg: n, to: m }), r = t.proofs ?? l({ blobs: s, commitments: b, kzg: n, to: m }), c = [];
|
|
6
|
+
for (let o = 0; o < s.length; o++)
|
|
7
|
+
c.push({
|
|
8
|
+
blob: s[o],
|
|
9
|
+
commitment: b[o],
|
|
10
|
+
proof: r[o]
|
|
11
|
+
});
|
|
12
|
+
return c;
|
|
8
13
|
}
|
|
9
14
|
export {
|
|
10
|
-
|
|
11
|
-
s as decoder,
|
|
12
|
-
d as encoder
|
|
15
|
+
k as toBlobSidecars
|
|
13
16
|
};
|
|
@@ -1,4 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
import { InvalidAddressError as s } from "./index.native71.js";
|
|
2
|
+
import { InvalidStorageKeySizeError as l } from "./index.native67.js";
|
|
3
|
+
import { isAddress as f } from "./index.native45.js";
|
|
4
|
+
function a(r) {
|
|
5
|
+
if (!r || r.length === 0)
|
|
6
|
+
return [];
|
|
7
|
+
const n = [];
|
|
8
|
+
for (let o = 0; o < r.length; o++) {
|
|
9
|
+
const { address: i, storageKeys: e } = r[o];
|
|
10
|
+
for (let t = 0; t < e.length; t++)
|
|
11
|
+
if (e[t].length - 2 !== 64)
|
|
12
|
+
throw new l({ storageKey: e[t] });
|
|
13
|
+
if (!f(i, { strict: !1 }))
|
|
14
|
+
throw new s({ address: i });
|
|
15
|
+
n.push([i, e]);
|
|
16
|
+
}
|
|
17
|
+
return n;
|
|
18
|
+
}
|
|
2
19
|
export {
|
|
3
|
-
|
|
20
|
+
a as serializeAccessList
|
|
4
21
|
};
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import { Provider as h } from "ox";
|
|
2
2
|
import { http as m } from "viem";
|
|
3
3
|
import { create as p } from "zustand";
|
|
4
|
-
import { subscribeWithSelector as g, persist as f } from "./index.
|
|
5
|
-
import { validateRequest as I, EIP1193ProviderError as
|
|
6
|
-
import { EventEmitter as
|
|
7
|
-
import { getPlatformStorage as
|
|
4
|
+
import { subscribeWithSelector as g, persist as f, createJSONStorage as S } from "./index.native29.js";
|
|
5
|
+
import { validateRequest as I, EIP1193ProviderError as w, STANDARD_ERROR_CODES as C } from "./index.native9.js";
|
|
6
|
+
import { EventEmitter as b } from "./index.native30.js";
|
|
7
|
+
import { getPlatformStorage as _ } from "./index.native5.js";
|
|
8
8
|
import "@coinbase/cdp-api-client";
|
|
9
|
-
import { handleGetCapabilities as
|
|
10
|
-
import { onAuthStateChange as
|
|
11
|
-
import { baseSepolia as l } from "./index.
|
|
12
|
-
function
|
|
9
|
+
import { handleGetCapabilities as A, handleGetCallsStatus as v, handleSendCalls as D, handleChainId as P, handleSignTypedData as E, handleEthSign as R, handleSwitchEthereumChain as y, handleDisconnect as T, handleSendTransaction as q, handlePersonalSign as N, handleRequestAccounts as O, handleAccounts as G } from "./index.native31.js";
|
|
10
|
+
import { onAuthStateChange as L } from "./index.native6.js";
|
|
11
|
+
import { baseSepolia as l } from "./index.native32.js";
|
|
12
|
+
function M(r, n, s) {
|
|
13
13
|
n.subscribe(
|
|
14
|
-
(
|
|
15
|
-
(
|
|
16
|
-
|
|
14
|
+
(t) => t.chainId,
|
|
15
|
+
(t, e) => {
|
|
16
|
+
t !== e && r.emit("chainChanged", t);
|
|
17
17
|
}
|
|
18
18
|
), n.subscribe(
|
|
19
|
-
(
|
|
20
|
-
(
|
|
21
|
-
if (!(
|
|
22
|
-
if (!
|
|
19
|
+
(t) => t.user,
|
|
20
|
+
(t, e) => {
|
|
21
|
+
if (!(t?.userId === e?.userId && t?.evmAccounts?.length === e?.evmAccounts?.length)) {
|
|
22
|
+
if (!t && e) {
|
|
23
23
|
r.emit("disconnect", new h.DisconnectedError());
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
|
-
if (
|
|
26
|
+
if (t && t.evmAccounts?.length && (!e || e.evmAccounts?.length === 0)) {
|
|
27
27
|
const a = n.getState().chainId;
|
|
28
28
|
r.emit("connect", { chainId: a });
|
|
29
29
|
return;
|
|
@@ -33,39 +33,39 @@ function N(r, n, s) {
|
|
|
33
33
|
);
|
|
34
34
|
const { chainId: i, setChainId: o } = n.getState(), d = i || s.chains[0].id;
|
|
35
35
|
return i || o(d), h.from({
|
|
36
|
-
request: async (
|
|
37
|
-
I(
|
|
38
|
-
const
|
|
39
|
-
switch (
|
|
36
|
+
request: async (t) => {
|
|
37
|
+
I(t, s);
|
|
38
|
+
const e = t;
|
|
39
|
+
switch (e.method) {
|
|
40
40
|
case "eth_accounts":
|
|
41
|
-
return
|
|
41
|
+
return G();
|
|
42
42
|
case "eth_requestAccounts":
|
|
43
|
-
return
|
|
43
|
+
return O(r, n);
|
|
44
44
|
case "personal_sign":
|
|
45
|
-
return
|
|
45
|
+
return N(e.params);
|
|
46
46
|
case "eth_sendTransaction":
|
|
47
|
-
return
|
|
47
|
+
return q(e.params, n, s.transports);
|
|
48
48
|
case "wallet_disconnect":
|
|
49
|
-
return
|
|
49
|
+
return T();
|
|
50
50
|
case "wallet_switchEthereumChain":
|
|
51
|
-
return
|
|
51
|
+
return y(e.params, n);
|
|
52
52
|
case "eth_sign":
|
|
53
|
-
return
|
|
53
|
+
return R(e.params);
|
|
54
54
|
case "eth_signTypedData_v4":
|
|
55
|
-
return
|
|
55
|
+
return E(e.params);
|
|
56
56
|
case "eth_chainId":
|
|
57
|
-
return
|
|
57
|
+
return P(n);
|
|
58
58
|
case "wallet_sendCalls":
|
|
59
|
-
return
|
|
59
|
+
return D(e.params, n);
|
|
60
60
|
case "wallet_getCallsStatus":
|
|
61
|
-
return
|
|
61
|
+
return v(e.params, n);
|
|
62
62
|
case "wallet_getCapabilities":
|
|
63
|
-
return
|
|
63
|
+
return A();
|
|
64
64
|
// Catch-all for any unknown method
|
|
65
65
|
default:
|
|
66
|
-
throw new
|
|
67
|
-
|
|
68
|
-
`Method ${
|
|
66
|
+
throw new w(
|
|
67
|
+
C.provider.unsupportedMethod,
|
|
68
|
+
`Method ${e.method} not supported`
|
|
69
69
|
);
|
|
70
70
|
}
|
|
71
71
|
},
|
|
@@ -80,42 +80,42 @@ const u = {
|
|
|
80
80
|
[l.id]: m()
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
|
-
function
|
|
83
|
+
function Q(r) {
|
|
84
84
|
if (r?.chains.length === 0)
|
|
85
85
|
throw new Error("At least one chain must be configured");
|
|
86
86
|
const n = r?.chains ?? u.chains, s = r?.transports ?? u.transports;
|
|
87
87
|
if (n.length === 0)
|
|
88
88
|
throw new Error("No chains found in configuration");
|
|
89
|
-
const i = new
|
|
90
|
-
getItem: (
|
|
91
|
-
setItem: (
|
|
92
|
-
removeItem: (
|
|
89
|
+
const i = new b(), o = _(), d = {
|
|
90
|
+
getItem: (e) => o.getItem(e),
|
|
91
|
+
setItem: (e, a) => o.setItem(e, a),
|
|
92
|
+
removeItem: (e) => o.removeItem(e)
|
|
93
93
|
}, c = p()(
|
|
94
94
|
g(
|
|
95
95
|
f(
|
|
96
|
-
(
|
|
96
|
+
(e) => ({
|
|
97
97
|
chainId: n[0].id,
|
|
98
|
-
setChainId: (a) =>
|
|
98
|
+
setChainId: (a) => e({ chainId: a }),
|
|
99
99
|
chains: n,
|
|
100
100
|
user: null,
|
|
101
|
-
setUser: (a) =>
|
|
101
|
+
setUser: (a) => e({ user: a })
|
|
102
102
|
}),
|
|
103
103
|
{
|
|
104
104
|
name: "cdp-provider-store",
|
|
105
|
-
storage: d
|
|
105
|
+
storage: S(() => d)
|
|
106
106
|
}
|
|
107
107
|
)
|
|
108
108
|
)
|
|
109
109
|
);
|
|
110
|
-
return c.persist.rehydrate(),
|
|
111
|
-
c.getState().setUser(
|
|
110
|
+
return c.persist.rehydrate(), L((e) => {
|
|
111
|
+
c.getState().setUser(e);
|
|
112
112
|
}), {
|
|
113
|
-
provider:
|
|
113
|
+
provider: M(i, c, {
|
|
114
114
|
chains: n,
|
|
115
115
|
transports: s
|
|
116
116
|
})
|
|
117
117
|
};
|
|
118
118
|
}
|
|
119
119
|
export {
|
|
120
|
-
|
|
120
|
+
Q as createCDPEmbeddedWallet
|
|
121
121
|
};
|
|
@@ -1,47 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
let e;
|
|
7
|
-
switch (r) {
|
|
8
|
-
case "sec":
|
|
9
|
-
case "secs":
|
|
10
|
-
case "second":
|
|
11
|
-
case "seconds":
|
|
12
|
-
case "s":
|
|
13
|
-
e = Math.round(a);
|
|
14
|
-
break;
|
|
15
|
-
case "minute":
|
|
16
|
-
case "minutes":
|
|
17
|
-
case "min":
|
|
18
|
-
case "mins":
|
|
19
|
-
case "m":
|
|
20
|
-
e = Math.round(a * 60);
|
|
21
|
-
break;
|
|
22
|
-
case "hour":
|
|
23
|
-
case "hours":
|
|
24
|
-
case "hr":
|
|
25
|
-
case "hrs":
|
|
26
|
-
case "h":
|
|
27
|
-
e = Math.round(a * 3600);
|
|
28
|
-
break;
|
|
29
|
-
case "day":
|
|
30
|
-
case "days":
|
|
31
|
-
case "d":
|
|
32
|
-
e = Math.round(a * 86400);
|
|
33
|
-
break;
|
|
34
|
-
case "week":
|
|
35
|
-
case "weeks":
|
|
36
|
-
case "w":
|
|
37
|
-
e = Math.round(a * 604800);
|
|
38
|
-
break;
|
|
39
|
-
default:
|
|
40
|
-
e = Math.round(a * 31557600);
|
|
41
|
-
break;
|
|
42
|
-
}
|
|
43
|
-
return s[1] === "-" || s[4] === "ago" ? -e : e;
|
|
44
|
-
};
|
|
1
|
+
import { gweiUnits as i } from "./index.native81.js";
|
|
2
|
+
import { formatUnits as o } from "./index.native82.js";
|
|
3
|
+
function f(r, t = "wei") {
|
|
4
|
+
return o(r, i[t]);
|
|
5
|
+
}
|
|
45
6
|
export {
|
|
46
|
-
|
|
7
|
+
f as formatGwei
|
|
47
8
|
};
|
|
@@ -1,16 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const r = (t) => {
|
|
5
|
-
if (!o(t) || Object.prototype.toString.call(t) !== "[object Object]")
|
|
6
|
-
return !1;
|
|
7
|
-
if (Object.getPrototypeOf(t) === null)
|
|
8
|
-
return !0;
|
|
9
|
-
let e = t;
|
|
10
|
-
for (; Object.getPrototypeOf(e) !== null; )
|
|
11
|
-
e = Object.getPrototypeOf(e);
|
|
12
|
-
return Object.getPrototypeOf(t) === e;
|
|
1
|
+
const e = {
|
|
2
|
+
ether: -9,
|
|
3
|
+
wei: 9
|
|
13
4
|
};
|
|
14
5
|
export {
|
|
15
|
-
|
|
6
|
+
e as gweiUnits
|
|
16
7
|
};
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
function a(r, n) {
|
|
2
|
+
let t = r.toString();
|
|
3
|
+
const i = t.startsWith("-");
|
|
4
|
+
i && (t = t.slice(1)), t = t.padStart(n, "0");
|
|
5
|
+
let [l, e] = [
|
|
6
|
+
t.slice(0, t.length - n),
|
|
7
|
+
t.slice(t.length - n)
|
|
8
|
+
];
|
|
9
|
+
return e = e.replace(/(0+)$/, ""), `${i ? "-" : ""}${l || "0"}${e ? `.${e}` : ""}`;
|
|
10
|
+
}
|
|
2
11
|
export {
|
|
3
|
-
|
|
12
|
+
a as formatUnits
|
|
4
13
|
};
|
|
@@ -1,23 +1,57 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { encode as d } from "./index.native95.js";
|
|
2
|
+
import y from "./index.native96.js";
|
|
3
|
+
import b from "./index.native97.js";
|
|
4
|
+
import { JWSInvalid as r } from "./index.native34.js";
|
|
5
|
+
import { encoder as s, concat as u, decoder as h } from "./index.native84.js";
|
|
6
|
+
import g from "./index.native98.js";
|
|
7
|
+
import H from "./index.native99.js";
|
|
8
|
+
import P from "./index.native100.js";
|
|
9
|
+
class x {
|
|
10
|
+
#r;
|
|
11
|
+
#e;
|
|
12
|
+
#t;
|
|
13
|
+
constructor(e) {
|
|
14
|
+
if (!(e instanceof Uint8Array))
|
|
15
|
+
throw new TypeError("payload must be an instance of Uint8Array");
|
|
16
|
+
this.#r = e;
|
|
7
17
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
18
|
+
setProtectedHeader(e) {
|
|
19
|
+
if (this.#e)
|
|
20
|
+
throw new TypeError("setProtectedHeader can only be called once");
|
|
21
|
+
return this.#e = e, this;
|
|
12
22
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
23
|
+
setUnprotectedHeader(e) {
|
|
24
|
+
if (this.#t)
|
|
25
|
+
throw new TypeError("setUnprotectedHeader can only be called once");
|
|
26
|
+
return this.#t = e, this;
|
|
27
|
+
}
|
|
28
|
+
async sign(e, l) {
|
|
29
|
+
if (!this.#e && !this.#t)
|
|
30
|
+
throw new r("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");
|
|
31
|
+
if (!b(this.#e, this.#t))
|
|
32
|
+
throw new r("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
|
|
33
|
+
const c = {
|
|
34
|
+
...this.#e,
|
|
35
|
+
...this.#t
|
|
36
|
+
}, p = H(r, /* @__PURE__ */ new Map([["b64", !0]]), l?.crit, this.#e, c);
|
|
37
|
+
let o = !0;
|
|
38
|
+
if (p.has("b64") && (o = this.#e.b64, typeof o != "boolean"))
|
|
39
|
+
throw new r('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
|
|
40
|
+
const { alg: t } = c;
|
|
41
|
+
if (typeof t != "string" || !t)
|
|
42
|
+
throw new r('JWS "alg" (Algorithm) Header Parameter missing or invalid');
|
|
43
|
+
g(t, e, "sign");
|
|
44
|
+
let i = this.#r;
|
|
45
|
+
o && (i = s.encode(d(i)));
|
|
46
|
+
let n;
|
|
47
|
+
this.#e ? n = s.encode(d(JSON.stringify(this.#e))) : n = s.encode("");
|
|
48
|
+
const f = u(n, s.encode("."), i), m = await P(e, t), w = await y(t, m, f), a = {
|
|
49
|
+
signature: d(w),
|
|
50
|
+
payload: ""
|
|
51
|
+
};
|
|
52
|
+
return o && (a.payload = h.decode(i)), this.#t && (a.header = this.#t), this.#e && (a.protected = h.decode(n)), a;
|
|
17
53
|
}
|
|
18
54
|
}
|
|
19
55
|
export {
|
|
20
|
-
|
|
21
|
-
n as PositionOutOfBoundsError,
|
|
22
|
-
c as RecursiveReadLimitExceededError
|
|
56
|
+
x as FlattenedSign
|
|
23
57
|
};
|