@privy-io/node 0.1.0-alpha.2
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/CHANGELOG.md +146 -0
- package/LICENSE +201 -0
- package/README.md +48 -0
- package/api-promise.d.mts +2 -0
- package/api-promise.d.mts.map +1 -0
- package/api-promise.d.ts +2 -0
- package/api-promise.d.ts.map +1 -0
- package/api-promise.js +6 -0
- package/api-promise.js.map +1 -0
- package/api-promise.mjs +2 -0
- package/api-promise.mjs.map +1 -0
- package/client.d.mts +215 -0
- package/client.d.mts.map +1 -0
- package/client.d.ts +215 -0
- package/client.d.ts.map +1 -0
- package/client.js +499 -0
- package/client.js.map +1 -0
- package/client.mjs +495 -0
- package/client.mjs.map +1 -0
- package/core/api-promise.d.mts +46 -0
- package/core/api-promise.d.mts.map +1 -0
- package/core/api-promise.d.ts +46 -0
- package/core/api-promise.d.ts.map +1 -0
- package/core/api-promise.js +74 -0
- package/core/api-promise.js.map +1 -0
- package/core/api-promise.mjs +70 -0
- package/core/api-promise.mjs.map +1 -0
- package/core/error.d.mts +46 -0
- package/core/error.d.mts.map +1 -0
- package/core/error.d.ts +46 -0
- package/core/error.d.ts.map +1 -0
- package/core/error.js +113 -0
- package/core/error.js.map +1 -0
- package/core/error.mjs +97 -0
- package/core/error.mjs.map +1 -0
- package/core/pagination.d.mts +54 -0
- package/core/pagination.d.mts.map +1 -0
- package/core/pagination.d.ts +54 -0
- package/core/pagination.d.ts.map +1 -0
- package/core/pagination.js +101 -0
- package/core/pagination.js.map +1 -0
- package/core/pagination.mjs +95 -0
- package/core/pagination.mjs.map +1 -0
- package/core/resource.d.mts +6 -0
- package/core/resource.d.mts.map +1 -0
- package/core/resource.d.ts +6 -0
- package/core/resource.d.ts.map +1 -0
- package/core/resource.js +11 -0
- package/core/resource.js.map +1 -0
- package/core/resource.mjs +7 -0
- package/core/resource.mjs.map +1 -0
- package/core/uploads.d.mts +3 -0
- package/core/uploads.d.mts.map +1 -0
- package/core/uploads.d.ts +3 -0
- package/core/uploads.d.ts.map +1 -0
- package/core/uploads.js +6 -0
- package/core/uploads.js.map +1 -0
- package/core/uploads.mjs +2 -0
- package/core/uploads.mjs.map +1 -0
- package/error.d.mts +2 -0
- package/error.d.mts.map +1 -0
- package/error.d.ts +2 -0
- package/error.d.ts.map +1 -0
- package/error.js +6 -0
- package/error.js.map +1 -0
- package/error.mjs +2 -0
- package/error.mjs.map +1 -0
- package/index.d.mts +13 -0
- package/index.d.mts.map +1 -0
- package/index.d.ts +13 -0
- package/index.d.ts.map +1 -0
- package/index.js +29 -0
- package/index.js.map +1 -0
- package/index.mjs +5 -0
- package/index.mjs.map +1 -0
- package/internal/builtin-types.d.mts +73 -0
- package/internal/builtin-types.d.mts.map +1 -0
- package/internal/builtin-types.d.ts +73 -0
- package/internal/builtin-types.d.ts.map +1 -0
- package/internal/builtin-types.js +4 -0
- package/internal/builtin-types.js.map +1 -0
- package/internal/builtin-types.mjs +3 -0
- package/internal/builtin-types.mjs.map +1 -0
- package/internal/detect-platform.d.mts +15 -0
- package/internal/detect-platform.d.mts.map +1 -0
- package/internal/detect-platform.d.ts +15 -0
- package/internal/detect-platform.d.ts.map +1 -0
- package/internal/detect-platform.js +162 -0
- package/internal/detect-platform.js.map +1 -0
- package/internal/detect-platform.mjs +157 -0
- package/internal/detect-platform.mjs.map +1 -0
- package/internal/errors.d.mts +3 -0
- package/internal/errors.d.mts.map +1 -0
- package/internal/errors.d.ts +3 -0
- package/internal/errors.d.ts.map +1 -0
- package/internal/errors.js +41 -0
- package/internal/errors.js.map +1 -0
- package/internal/errors.mjs +36 -0
- package/internal/errors.mjs.map +1 -0
- package/internal/headers.d.mts +6 -0
- package/internal/headers.d.mts.map +1 -0
- package/internal/headers.d.ts +6 -0
- package/internal/headers.d.ts.map +1 -0
- package/internal/headers.js +79 -0
- package/internal/headers.js.map +1 -0
- package/internal/headers.mjs +74 -0
- package/internal/headers.mjs.map +1 -0
- package/internal/parse.d.mts +12 -0
- package/internal/parse.d.mts.map +1 -0
- package/internal/parse.d.ts +12 -0
- package/internal/parse.d.ts.map +1 -0
- package/internal/parse.js +35 -0
- package/internal/parse.js.map +1 -0
- package/internal/parse.mjs +32 -0
- package/internal/parse.mjs.map +1 -0
- package/internal/qs/formats.d.mts +7 -0
- package/internal/qs/formats.d.mts.map +1 -0
- package/internal/qs/formats.d.ts +7 -0
- package/internal/qs/formats.d.ts.map +1 -0
- package/internal/qs/formats.js +13 -0
- package/internal/qs/formats.js.map +1 -0
- package/internal/qs/formats.mjs +9 -0
- package/internal/qs/formats.mjs.map +1 -0
- package/internal/qs/index.d.mts +10 -0
- package/internal/qs/index.d.mts.map +1 -0
- package/internal/qs/index.d.ts +10 -0
- package/internal/qs/index.d.ts.map +1 -0
- package/internal/qs/index.js +14 -0
- package/internal/qs/index.js.map +1 -0
- package/internal/qs/index.mjs +10 -0
- package/internal/qs/index.mjs.map +1 -0
- package/internal/qs/stringify.d.mts +3 -0
- package/internal/qs/stringify.d.mts.map +1 -0
- package/internal/qs/stringify.d.ts +3 -0
- package/internal/qs/stringify.d.ts.map +1 -0
- package/internal/qs/stringify.js +277 -0
- package/internal/qs/stringify.js.map +1 -0
- package/internal/qs/stringify.mjs +274 -0
- package/internal/qs/stringify.mjs.map +1 -0
- package/internal/qs/types.d.mts +57 -0
- package/internal/qs/types.d.mts.map +1 -0
- package/internal/qs/types.d.ts +57 -0
- package/internal/qs/types.d.ts.map +1 -0
- package/internal/qs/types.js +3 -0
- package/internal/qs/types.js.map +1 -0
- package/internal/qs/types.mjs +2 -0
- package/internal/qs/types.mjs.map +1 -0
- package/internal/qs/utils.d.mts +15 -0
- package/internal/qs/utils.d.mts.map +1 -0
- package/internal/qs/utils.d.ts +15 -0
- package/internal/qs/utils.d.ts.map +1 -0
- package/internal/qs/utils.js +230 -0
- package/internal/qs/utils.js.map +1 -0
- package/internal/qs/utils.mjs +217 -0
- package/internal/qs/utils.mjs.map +1 -0
- package/internal/request-options.d.mts +75 -0
- package/internal/request-options.d.mts.map +1 -0
- package/internal/request-options.d.ts +75 -0
- package/internal/request-options.d.ts.map +1 -0
- package/internal/request-options.js +14 -0
- package/internal/request-options.js.map +1 -0
- package/internal/request-options.mjs +10 -0
- package/internal/request-options.mjs.map +1 -0
- package/internal/shim-types.d.mts +17 -0
- package/internal/shim-types.d.mts.map +1 -0
- package/internal/shim-types.d.ts +17 -0
- package/internal/shim-types.d.ts.map +1 -0
- package/internal/shim-types.js +4 -0
- package/internal/shim-types.js.map +1 -0
- package/internal/shim-types.mjs +3 -0
- package/internal/shim-types.mjs.map +1 -0
- package/internal/shims.d.mts +20 -0
- package/internal/shims.d.mts.map +1 -0
- package/internal/shims.d.ts +20 -0
- package/internal/shims.d.ts.map +1 -0
- package/internal/shims.js +92 -0
- package/internal/shims.js.map +1 -0
- package/internal/shims.mjs +85 -0
- package/internal/shims.mjs.map +1 -0
- package/internal/to-file.d.mts +45 -0
- package/internal/to-file.d.mts.map +1 -0
- package/internal/to-file.d.ts +45 -0
- package/internal/to-file.d.ts.map +1 -0
- package/internal/to-file.js +91 -0
- package/internal/to-file.js.map +1 -0
- package/internal/to-file.mjs +88 -0
- package/internal/to-file.mjs.map +1 -0
- package/internal/tslib.js +85 -0
- package/internal/tslib.mjs +17 -0
- package/internal/types.d.mts +69 -0
- package/internal/types.d.mts.map +1 -0
- package/internal/types.d.ts +69 -0
- package/internal/types.d.ts.map +1 -0
- package/internal/types.js +4 -0
- package/internal/types.js.map +1 -0
- package/internal/types.mjs +3 -0
- package/internal/types.mjs.map +1 -0
- package/internal/uploads.d.mts +42 -0
- package/internal/uploads.d.mts.map +1 -0
- package/internal/uploads.d.ts +42 -0
- package/internal/uploads.d.ts.map +1 -0
- package/internal/uploads.js +141 -0
- package/internal/uploads.js.map +1 -0
- package/internal/uploads.mjs +131 -0
- package/internal/uploads.mjs.map +1 -0
- package/internal/utils/base64.d.mts +3 -0
- package/internal/utils/base64.d.mts.map +1 -0
- package/internal/utils/base64.d.ts +3 -0
- package/internal/utils/base64.d.ts.map +1 -0
- package/internal/utils/base64.js +38 -0
- package/internal/utils/base64.js.map +1 -0
- package/internal/utils/base64.mjs +33 -0
- package/internal/utils/base64.mjs.map +1 -0
- package/internal/utils/bytes.d.mts +4 -0
- package/internal/utils/bytes.d.mts.map +1 -0
- package/internal/utils/bytes.d.ts +4 -0
- package/internal/utils/bytes.d.ts.map +1 -0
- package/internal/utils/bytes.js +31 -0
- package/internal/utils/bytes.js.map +1 -0
- package/internal/utils/bytes.mjs +26 -0
- package/internal/utils/bytes.mjs.map +1 -0
- package/internal/utils/env.d.mts +9 -0
- package/internal/utils/env.d.mts.map +1 -0
- package/internal/utils/env.d.ts +9 -0
- package/internal/utils/env.d.ts.map +1 -0
- package/internal/utils/env.js +22 -0
- package/internal/utils/env.js.map +1 -0
- package/internal/utils/env.mjs +18 -0
- package/internal/utils/env.mjs.map +1 -0
- package/internal/utils/log.d.mts +37 -0
- package/internal/utils/log.d.mts.map +1 -0
- package/internal/utils/log.d.ts +37 -0
- package/internal/utils/log.d.ts.map +1 -0
- package/internal/utils/log.js +85 -0
- package/internal/utils/log.js.map +1 -0
- package/internal/utils/log.mjs +79 -0
- package/internal/utils/log.mjs.map +1 -0
- package/internal/utils/path.d.mts +15 -0
- package/internal/utils/path.d.mts.map +1 -0
- package/internal/utils/path.d.ts +15 -0
- package/internal/utils/path.d.ts.map +1 -0
- package/internal/utils/path.js +79 -0
- package/internal/utils/path.js.map +1 -0
- package/internal/utils/path.mjs +74 -0
- package/internal/utils/path.mjs.map +1 -0
- package/internal/utils/sleep.d.mts +2 -0
- package/internal/utils/sleep.d.mts.map +1 -0
- package/internal/utils/sleep.d.ts +2 -0
- package/internal/utils/sleep.d.ts.map +1 -0
- package/internal/utils/sleep.js +7 -0
- package/internal/utils/sleep.js.map +1 -0
- package/internal/utils/sleep.mjs +3 -0
- package/internal/utils/sleep.mjs.map +1 -0
- package/internal/utils/uuid.d.mts +5 -0
- package/internal/utils/uuid.d.mts.map +1 -0
- package/internal/utils/uuid.d.ts +5 -0
- package/internal/utils/uuid.d.ts.map +1 -0
- package/internal/utils/uuid.js +19 -0
- package/internal/utils/uuid.js.map +1 -0
- package/internal/utils/uuid.mjs +15 -0
- package/internal/utils/uuid.mjs.map +1 -0
- package/internal/utils/values.d.mts +18 -0
- package/internal/utils/values.d.mts.map +1 -0
- package/internal/utils/values.d.ts +18 -0
- package/internal/utils/values.d.ts.map +1 -0
- package/internal/utils/values.js +112 -0
- package/internal/utils/values.js.map +1 -0
- package/internal/utils/values.mjs +94 -0
- package/internal/utils/values.mjs.map +1 -0
- package/internal/utils.d.mts +7 -0
- package/internal/utils.d.mts.map +1 -0
- package/internal/utils.d.ts +7 -0
- package/internal/utils.d.ts.map +1 -0
- package/internal/utils.js +11 -0
- package/internal/utils.js.map +1 -0
- package/internal/utils.mjs +8 -0
- package/internal/utils.mjs.map +1 -0
- package/lib/authorization.d.mts +87 -0
- package/lib/authorization.d.mts.map +1 -0
- package/lib/authorization.d.ts +87 -0
- package/lib/authorization.d.ts.map +1 -0
- package/lib/authorization.js +73 -0
- package/lib/authorization.js.map +1 -0
- package/lib/authorization.mjs +67 -0
- package/lib/authorization.mjs.map +1 -0
- package/lib/cryptography.d.mts +8 -0
- package/lib/cryptography.d.mts.map +1 -0
- package/lib/cryptography.d.ts +8 -0
- package/lib/cryptography.d.ts.map +1 -0
- package/lib/cryptography.js +72 -0
- package/lib/cryptography.js.map +1 -0
- package/lib/cryptography.mjs +67 -0
- package/lib/cryptography.mjs.map +1 -0
- package/lib/jwt-exchange.d.mts +9 -0
- package/lib/jwt-exchange.d.mts.map +1 -0
- package/lib/jwt-exchange.d.ts +9 -0
- package/lib/jwt-exchange.d.ts.map +1 -0
- package/lib/jwt-exchange.js +55 -0
- package/lib/jwt-exchange.js.map +1 -0
- package/lib/jwt-exchange.mjs +51 -0
- package/lib/jwt-exchange.mjs.map +1 -0
- package/lib/wallet-entropy.d.mts +7 -0
- package/lib/wallet-entropy.d.mts.map +1 -0
- package/lib/wallet-entropy.d.ts +7 -0
- package/lib/wallet-entropy.d.ts.map +1 -0
- package/lib/wallet-entropy.js +44 -0
- package/lib/wallet-entropy.js.map +1 -0
- package/lib/wallet-entropy.mjs +41 -0
- package/lib/wallet-entropy.mjs.map +1 -0
- package/package.json +46 -0
- package/pagination.d.mts +2 -0
- package/pagination.d.mts.map +1 -0
- package/pagination.d.ts +2 -0
- package/pagination.d.ts.map +1 -0
- package/pagination.js +6 -0
- package/pagination.js.map +1 -0
- package/pagination.mjs +2 -0
- package/pagination.mjs.map +1 -0
- package/public-api/PrivyClient.d.mts +33 -0
- package/public-api/PrivyClient.d.mts.map +1 -0
- package/public-api/PrivyClient.d.ts +33 -0
- package/public-api/PrivyClient.d.ts.map +1 -0
- package/public-api/PrivyClient.js +59 -0
- package/public-api/PrivyClient.js.map +1 -0
- package/public-api/PrivyClient.mjs +55 -0
- package/public-api/PrivyClient.mjs.map +1 -0
- package/public-api/services/ethereum.d.mts +39 -0
- package/public-api/services/ethereum.d.mts.map +1 -0
- package/public-api/services/ethereum.d.ts +39 -0
- package/public-api/services/ethereum.d.ts.map +1 -0
- package/public-api/services/ethereum.js +77 -0
- package/public-api/services/ethereum.js.map +1 -0
- package/public-api/services/ethereum.mjs +73 -0
- package/public-api/services/ethereum.mjs.map +1 -0
- package/public-api/services/key-quorums.d.mts +18 -0
- package/public-api/services/key-quorums.d.mts.map +1 -0
- package/public-api/services/key-quorums.d.ts +18 -0
- package/public-api/services/key-quorums.d.ts.map +1 -0
- package/public-api/services/key-quorums.js +51 -0
- package/public-api/services/key-quorums.js.map +1 -0
- package/public-api/services/key-quorums.mjs +47 -0
- package/public-api/services/key-quorums.mjs.map +1 -0
- package/public-api/services/policies.d.mts +27 -0
- package/public-api/services/policies.d.mts.map +1 -0
- package/public-api/services/policies.d.ts +27 -0
- package/public-api/services/policies.d.ts.map +1 -0
- package/public-api/services/policies.js +110 -0
- package/public-api/services/policies.js.map +1 -0
- package/public-api/services/policies.mjs +106 -0
- package/public-api/services/policies.mjs.map +1 -0
- package/public-api/services/solana.d.mts +42 -0
- package/public-api/services/solana.d.mts.map +1 -0
- package/public-api/services/solana.d.ts +42 -0
- package/public-api/services/solana.d.ts.map +1 -0
- package/public-api/services/solana.js +67 -0
- package/public-api/services/solana.js.map +1 -0
- package/public-api/services/solana.mjs +63 -0
- package/public-api/services/solana.mjs.map +1 -0
- package/public-api/services/transactions.d.mts +4 -0
- package/public-api/services/transactions.d.mts.map +1 -0
- package/public-api/services/transactions.d.ts +4 -0
- package/public-api/services/transactions.d.ts.map +1 -0
- package/public-api/services/transactions.js +8 -0
- package/public-api/services/transactions.js.map +1 -0
- package/public-api/services/transactions.mjs +4 -0
- package/public-api/services/transactions.mjs.map +1 -0
- package/public-api/services/types.d.mts +54 -0
- package/public-api/services/types.d.mts.map +1 -0
- package/public-api/services/types.d.ts +54 -0
- package/public-api/services/types.d.ts.map +1 -0
- package/public-api/services/types.js +3 -0
- package/public-api/services/types.js.map +1 -0
- package/public-api/services/types.mjs +2 -0
- package/public-api/services/types.mjs.map +1 -0
- package/public-api/services/users.d.mts +4 -0
- package/public-api/services/users.d.mts.map +1 -0
- package/public-api/services/users.d.ts +4 -0
- package/public-api/services/users.d.ts.map +1 -0
- package/public-api/services/users.js +8 -0
- package/public-api/services/users.js.map +1 -0
- package/public-api/services/users.mjs +4 -0
- package/public-api/services/users.mjs.map +1 -0
- package/public-api/services/utils.d.mts +26 -0
- package/public-api/services/utils.d.mts.map +1 -0
- package/public-api/services/utils.d.ts +26 -0
- package/public-api/services/utils.d.ts.map +1 -0
- package/public-api/services/utils.js +18 -0
- package/public-api/services/utils.js.map +1 -0
- package/public-api/services/utils.mjs +14 -0
- package/public-api/services/utils.mjs.map +1 -0
- package/public-api/services/wallets.d.mts +70 -0
- package/public-api/services/wallets.d.mts.map +1 -0
- package/public-api/services/wallets.d.ts +70 -0
- package/public-api/services/wallets.d.ts.map +1 -0
- package/public-api/services/wallets.js +145 -0
- package/public-api/services/wallets.js.map +1 -0
- package/public-api/services/wallets.mjs +141 -0
- package/public-api/services/wallets.mjs.map +1 -0
- package/resource.d.mts +2 -0
- package/resource.d.mts.map +1 -0
- package/resource.d.ts +2 -0
- package/resource.d.ts.map +1 -0
- package/resource.js +6 -0
- package/resource.js.map +1 -0
- package/resource.mjs +2 -0
- package/resource.mjs.map +1 -0
- package/resources/index.d.mts +6 -0
- package/resources/index.d.mts.map +1 -0
- package/resources/index.d.ts +6 -0
- package/resources/index.d.ts.map +1 -0
- package/resources/index.js +15 -0
- package/resources/index.js.map +1 -0
- package/resources/index.mjs +7 -0
- package/resources/index.mjs.map +1 -0
- package/resources/key-quorums.d.mts +106 -0
- package/resources/key-quorums.d.mts.map +1 -0
- package/resources/key-quorums.d.ts +106 -0
- package/resources/key-quorums.d.ts.map +1 -0
- package/resources/key-quorums.js +84 -0
- package/resources/key-quorums.js.map +1 -0
- package/resources/key-quorums.mjs +80 -0
- package/resources/key-quorums.mjs.map +1 -0
- package/resources/policies.d.mts +1283 -0
- package/resources/policies.d.mts.map +1 -0
- package/resources/policies.d.ts +1283 -0
- package/resources/policies.d.ts.map +1 -0
- package/resources/policies.js +228 -0
- package/resources/policies.js.map +1 -0
- package/resources/policies.mjs +224 -0
- package/resources/policies.mjs.map +1 -0
- package/resources/transactions.d.mts +29 -0
- package/resources/transactions.d.mts.map +1 -0
- package/resources/transactions.d.ts +29 -0
- package/resources/transactions.d.ts.map +1 -0
- package/resources/transactions.js +23 -0
- package/resources/transactions.js.map +1 -0
- package/resources/transactions.mjs +19 -0
- package/resources/transactions.mjs.map +1 -0
- package/resources/users.d.mts +766 -0
- package/resources/users.d.mts.map +1 -0
- package/resources/users.d.ts +766 -0
- package/resources/users.d.ts.map +1 -0
- package/resources/users.js +278 -0
- package/resources/users.js.map +1 -0
- package/resources/users.mjs +274 -0
- package/resources/users.mjs.map +1 -0
- package/resources/wallets/balance.d.mts +40 -0
- package/resources/wallets/balance.d.mts.map +1 -0
- package/resources/wallets/balance.d.ts +40 -0
- package/resources/wallets/balance.d.ts.map +1 -0
- package/resources/wallets/balance.js +24 -0
- package/resources/wallets/balance.js.map +1 -0
- package/resources/wallets/balance.mjs +20 -0
- package/resources/wallets/balance.mjs.map +1 -0
- package/resources/wallets/index.d.mts +4 -0
- package/resources/wallets/index.d.mts.map +1 -0
- package/resources/wallets/index.d.ts +4 -0
- package/resources/wallets/index.d.ts.map +1 -0
- package/resources/wallets/index.js +11 -0
- package/resources/wallets/index.js.map +1 -0
- package/resources/wallets/index.mjs +5 -0
- package/resources/wallets/index.mjs.map +1 -0
- package/resources/wallets/transactions.d.mts +73 -0
- package/resources/wallets/transactions.d.mts.map +1 -0
- package/resources/wallets/transactions.d.ts +73 -0
- package/resources/wallets/transactions.d.ts.map +1 -0
- package/resources/wallets/transactions.js +24 -0
- package/resources/wallets/transactions.js.map +1 -0
- package/resources/wallets/transactions.mjs +20 -0
- package/resources/wallets/transactions.mjs.map +1 -0
- package/resources/wallets/wallets.d.mts +1122 -0
- package/resources/wallets/wallets.d.mts.map +1 -0
- package/resources/wallets/wallets.d.ts +1122 -0
- package/resources/wallets/wallets.d.ts.map +1 -0
- package/resources/wallets/wallets.js +235 -0
- package/resources/wallets/wallets.js.map +1 -0
- package/resources/wallets/wallets.mjs +230 -0
- package/resources/wallets/wallets.mjs.map +1 -0
- package/resources/wallets.d.mts +2 -0
- package/resources/wallets.d.mts.map +1 -0
- package/resources/wallets.d.ts +2 -0
- package/resources/wallets.d.ts.map +1 -0
- package/resources/wallets.js +6 -0
- package/resources/wallets.js.map +1 -0
- package/resources/wallets.mjs +3 -0
- package/resources/wallets.mjs.map +1 -0
- package/resources.d.mts +2 -0
- package/resources.d.mts.map +1 -0
- package/resources.d.ts +2 -0
- package/resources.d.ts.map +1 -0
- package/resources.js +5 -0
- package/resources.js.map +1 -0
- package/resources.mjs +2 -0
- package/resources.mjs.map +1 -0
- package/src/api-promise.ts +2 -0
- package/src/client.ts +942 -0
- package/src/core/README.md +3 -0
- package/src/core/api-promise.ts +92 -0
- package/src/core/error.ts +130 -0
- package/src/core/pagination.ts +157 -0
- package/src/core/resource.ts +11 -0
- package/src/core/uploads.ts +2 -0
- package/src/error.ts +2 -0
- package/src/index.ts +34 -0
- package/src/internal/README.md +3 -0
- package/src/internal/builtin-types.ts +93 -0
- package/src/internal/detect-platform.ts +196 -0
- package/src/internal/errors.ts +33 -0
- package/src/internal/headers.ts +97 -0
- package/src/internal/parse.ts +50 -0
- package/src/internal/qs/LICENSE.md +13 -0
- package/src/internal/qs/README.md +3 -0
- package/src/internal/qs/formats.ts +10 -0
- package/src/internal/qs/index.ts +13 -0
- package/src/internal/qs/stringify.ts +385 -0
- package/src/internal/qs/types.ts +71 -0
- package/src/internal/qs/utils.ts +265 -0
- package/src/internal/request-options.ts +91 -0
- package/src/internal/shim-types.ts +26 -0
- package/src/internal/shims.ts +107 -0
- package/src/internal/to-file.ts +154 -0
- package/src/internal/types.ts +95 -0
- package/src/internal/uploads.ts +187 -0
- package/src/internal/utils/base64.ts +40 -0
- package/src/internal/utils/bytes.ts +32 -0
- package/src/internal/utils/env.ts +18 -0
- package/src/internal/utils/log.ts +126 -0
- package/src/internal/utils/path.ts +88 -0
- package/src/internal/utils/sleep.ts +3 -0
- package/src/internal/utils/uuid.ts +17 -0
- package/src/internal/utils/values.ts +105 -0
- package/src/internal/utils.ts +8 -0
- package/src/lib/.keep +4 -0
- package/src/lib/authorization.ts +153 -0
- package/src/lib/cryptography.ts +109 -0
- package/src/lib/jwt-exchange.ts +65 -0
- package/src/lib/wallet-entropy.ts +48 -0
- package/src/pagination.ts +2 -0
- package/src/public-api/PrivyClient.ts +91 -0
- package/src/public-api/services/ethereum.ts +134 -0
- package/src/public-api/services/key-quorums.ts +77 -0
- package/src/public-api/services/policies.ts +175 -0
- package/src/public-api/services/solana.ts +111 -0
- package/src/public-api/services/transactions.ts +3 -0
- package/src/public-api/services/types.ts +50 -0
- package/src/public-api/services/users.ts +3 -0
- package/src/public-api/services/utils.ts +40 -0
- package/src/public-api/services/wallets.ts +270 -0
- package/src/resource.ts +2 -0
- package/src/resources/index.ts +71 -0
- package/src/resources/key-quorums.ts +177 -0
- package/src/resources/policies.ts +1992 -0
- package/src/resources/transactions.ts +42 -0
- package/src/resources/users.ts +1312 -0
- package/src/resources/wallets/balance.ts +62 -0
- package/src/resources/wallets/index.ts +25 -0
- package/src/resources/wallets/transactions.ts +116 -0
- package/src/resources/wallets/wallets.ts +1609 -0
- package/src/resources/wallets.ts +3 -0
- package/src/resources.ts +1 -0
- package/src/tsconfig.json +11 -0
- package/src/uploads.ts +2 -0
- package/src/version.ts +1 -0
- package/uploads.d.mts +2 -0
- package/uploads.d.mts.map +1 -0
- package/uploads.d.ts +2 -0
- package/uploads.d.ts.map +1 -0
- package/uploads.js +6 -0
- package/uploads.js.map +1 -0
- package/uploads.mjs +2 -0
- package/uploads.mjs.map +1 -0
- package/version.d.mts +2 -0
- package/version.d.mts.map +1 -0
- package/version.d.ts +2 -0
- package/version.d.ts.map +1 -0
- package/version.js +5 -0
- package/version.js.map +1 -0
- package/version.mjs +2 -0
- package/version.mjs.map +1 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { WalletRpcParams, WalletRpcResponse } from '../../resources';
|
|
2
|
+
import { ReplaceParams, PrivyWalletsService } from './wallets';
|
|
3
|
+
import { PrivyWalletsRpcInput } from './wallets';
|
|
4
|
+
|
|
5
|
+
export class PrivyEthereumService {
|
|
6
|
+
private privyWalletsService: PrivyWalletsService;
|
|
7
|
+
|
|
8
|
+
constructor(privyWalletsService: PrivyWalletsService) {
|
|
9
|
+
this.privyWalletsService = privyWalletsService;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
public async signMessage(
|
|
13
|
+
walletId: string,
|
|
14
|
+
{ message, ...input }: PrivyEthereumService.SignMessageInput,
|
|
15
|
+
): Promise<WalletRpcResponse.EthereumPersonalSignRpcResponse.Data> {
|
|
16
|
+
let params: WalletRpcParams.EthereumPersonalSignRpcInput.Params;
|
|
17
|
+
if (message instanceof Uint8Array) {
|
|
18
|
+
// We fall back to `Buffer` here as Uint8Array.toHex is not widely supported yet
|
|
19
|
+
params = { message: Buffer.from(message).toString('hex'), encoding: 'hex' };
|
|
20
|
+
} else if (message.startsWith('0x')) {
|
|
21
|
+
// The 0x prefix is removed as `encoding: hex` is sufficient
|
|
22
|
+
params = { message: message.slice(2), encoding: 'hex' };
|
|
23
|
+
} else {
|
|
24
|
+
params = { message, encoding: 'utf-8' };
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const response = await this.privyWalletsService.rpc(walletId, {
|
|
28
|
+
...input,
|
|
29
|
+
params,
|
|
30
|
+
method: 'personal_sign',
|
|
31
|
+
chain_type: 'ethereum',
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
return response.data;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public async signSecp256k1(
|
|
38
|
+
walletId: string,
|
|
39
|
+
input: PrivyEthereumService.SignSecp256k1Input,
|
|
40
|
+
): Promise<WalletRpcResponse.EthereumSecp256k1SignRpcResponse.Data> {
|
|
41
|
+
const response = await this.privyWalletsService.rpc(walletId, {
|
|
42
|
+
...input,
|
|
43
|
+
method: 'secp256k1_sign',
|
|
44
|
+
chain_type: 'ethereum',
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
return response.data;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public async sign7702Authorization(
|
|
51
|
+
walletId: string,
|
|
52
|
+
input: PrivyEthereumService.Sign7702AuthorizationInput,
|
|
53
|
+
): Promise<WalletRpcResponse.EthereumSign7702AuthorizationRpcResponse.Data> {
|
|
54
|
+
const response = await this.privyWalletsService.rpc(walletId, {
|
|
55
|
+
...input,
|
|
56
|
+
method: 'eth_sign7702Authorization',
|
|
57
|
+
chain_type: 'ethereum',
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
if (!response.data) {
|
|
61
|
+
throw new Error(response.error?.message ?? 'Unexpected response from Privy API');
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return response.data;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
public async signTransaction(
|
|
68
|
+
walletId: string,
|
|
69
|
+
input: PrivyEthereumService.SignTransactionInput,
|
|
70
|
+
): Promise<WalletRpcResponse.EthereumSignTransactionRpcResponse.Data> {
|
|
71
|
+
const response = await this.privyWalletsService.rpc(walletId, {
|
|
72
|
+
...input,
|
|
73
|
+
method: 'eth_signTransaction',
|
|
74
|
+
chain_type: 'ethereum',
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
return response.data;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
public async signTypedData(
|
|
81
|
+
walletId: string,
|
|
82
|
+
input: PrivyEthereumService.SignTypedDataInput,
|
|
83
|
+
): Promise<WalletRpcResponse.EthereumSignTypedDataRpcResponse.Data> {
|
|
84
|
+
const response = await this.privyWalletsService.rpc(walletId, {
|
|
85
|
+
...input,
|
|
86
|
+
method: 'eth_signTypedData_v4',
|
|
87
|
+
chain_type: 'ethereum',
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
return response.data;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
public async sendTransaction(
|
|
94
|
+
walletId: string,
|
|
95
|
+
input: PrivyEthereumService.SendTransactionInput,
|
|
96
|
+
): Promise<WalletRpcResponse.EthereumSendTransactionRpcResponse.Data> {
|
|
97
|
+
const response = await this.privyWalletsService.rpc(walletId, {
|
|
98
|
+
...input,
|
|
99
|
+
method: 'eth_sendTransaction',
|
|
100
|
+
chain_type: 'ethereum',
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
if (!response.data) {
|
|
104
|
+
throw new Error(response.error?.message ?? 'Unexpected response from Privy API');
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return response.data;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// prettier-ignore
|
|
112
|
+
/**
|
|
113
|
+
* The namespace for types related to the Ethereum service class.
|
|
114
|
+
* @see {@link PrivyEthereumService} class.
|
|
115
|
+
* @see {@link PrivyWalletsRpcInput} type.
|
|
116
|
+
*/
|
|
117
|
+
export namespace PrivyEthereumService {
|
|
118
|
+
/**
|
|
119
|
+
* The input type for the {@link PrivyEthereumService.signMessage} method.
|
|
120
|
+
* Instead of accepting the raw `params` object, it accepts a message `string` or `Uint8Array`
|
|
121
|
+
* that is automatically converted to the right `params` object.
|
|
122
|
+
*/
|
|
123
|
+
export type SignMessageInput = ReplaceParams<PrivyWalletsRpcInput<WalletRpcParams.EthereumPersonalSignRpcInput>, {message: string | Uint8Array}>;
|
|
124
|
+
/** The input type for the {@link PrivyEthereumService.signSecp256k1} method. */
|
|
125
|
+
export type SignSecp256k1Input = PrivyWalletsRpcInput<WalletRpcParams.EthereumSecp256k1SignRpcInput>;
|
|
126
|
+
/** The input type for the {@link PrivyEthereumService.sign7702Authorization} method. */
|
|
127
|
+
export type Sign7702AuthorizationInput = PrivyWalletsRpcInput<WalletRpcParams.EthereumSign7702AuthorizationRpcInput>;
|
|
128
|
+
/** The input type for the {@link PrivyEthereumService.signTransaction} method. */
|
|
129
|
+
export type SignTransactionInput = PrivyWalletsRpcInput<WalletRpcParams.EthereumSignTransactionRpcInput>;
|
|
130
|
+
/** The input type for the {@link PrivyEthereumService.signTypedData} method. */
|
|
131
|
+
export type SignTypedDataInput = PrivyWalletsRpcInput<WalletRpcParams.EthereumSignTypedDataRpcInput>;
|
|
132
|
+
/** The input type for the {@link PrivyEthereumService.sendTransaction} method. */
|
|
133
|
+
export type SendTransactionInput = PrivyWalletsRpcInput<WalletRpcParams.EthereumSendTransactionRpcInput>;
|
|
134
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Prettify } from 'viem';
|
|
2
|
+
import { PrivyAPI } from '../../client';
|
|
3
|
+
import { generateAuthorizationSignatures } from '../../lib/authorization';
|
|
4
|
+
import {
|
|
5
|
+
KeyQuorum,
|
|
6
|
+
KeyQuorumDeleteParams,
|
|
7
|
+
KeyQuorumDeleteResponse,
|
|
8
|
+
KeyQuorums,
|
|
9
|
+
KeyQuorumUpdateParams,
|
|
10
|
+
} from '../../resources';
|
|
11
|
+
import { PrivyClient } from '../PrivyClient';
|
|
12
|
+
import { WithAuthorization } from './types';
|
|
13
|
+
|
|
14
|
+
export class PrivyKeyQuorumsService extends KeyQuorums {
|
|
15
|
+
private privyClient: PrivyClient;
|
|
16
|
+
|
|
17
|
+
constructor(privyApiClient: PrivyAPI, privyClient: PrivyClient) {
|
|
18
|
+
super(privyApiClient);
|
|
19
|
+
this.privyClient = privyClient;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
public async update(
|
|
23
|
+
keyQuorumId: string,
|
|
24
|
+
{ authorization_context: authorizationContext = {}, ...params }: PrivyKeyQuorumsService.UpdateInput,
|
|
25
|
+
): Promise<KeyQuorum> {
|
|
26
|
+
const authorizationSignaturesHeader = await generateAuthorizationSignatures(this.privyClient, {
|
|
27
|
+
authorizationContext,
|
|
28
|
+
input: {
|
|
29
|
+
version: 1,
|
|
30
|
+
method: 'PATCH',
|
|
31
|
+
url: `${this._client.baseURL}/v1/key_quorums/${keyQuorumId}`,
|
|
32
|
+
body: params,
|
|
33
|
+
headers: {
|
|
34
|
+
'privy-app-id': this._client.appID,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const response = await this._update(keyQuorumId, {
|
|
40
|
+
...params,
|
|
41
|
+
'privy-authorization-signature': authorizationSignaturesHeader.join(','),
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
return response;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public async delete(
|
|
48
|
+
keyQuorumId: string,
|
|
49
|
+
{ authorization_context: authorizationContext = {}, ...params }: PrivyKeyQuorumsService.DeleteInput,
|
|
50
|
+
): Promise<KeyQuorumDeleteResponse> {
|
|
51
|
+
const authorizationSignaturesHeader = await generateAuthorizationSignatures(this.privyClient, {
|
|
52
|
+
authorizationContext,
|
|
53
|
+
input: {
|
|
54
|
+
version: 1,
|
|
55
|
+
method: 'DELETE',
|
|
56
|
+
url: `${this._client.baseURL}/v1/key_quorums/${keyQuorumId}`,
|
|
57
|
+
body: params,
|
|
58
|
+
headers: {
|
|
59
|
+
'privy-app-id': this._client.appID,
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
const response = await this._delete(keyQuorumId, {
|
|
65
|
+
...params,
|
|
66
|
+
'privy-authorization-signature': authorizationSignaturesHeader.join(','),
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
return response;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
export namespace PrivyKeyQuorumsService {
|
|
73
|
+
/** The input type for the {@link PrivyKeyQuorumsService.update} method. */
|
|
74
|
+
export type UpdateInput = Prettify<WithAuthorization<KeyQuorumUpdateParams>>;
|
|
75
|
+
/** The input type for the {@link PrivyKeyQuorumsService.delete} method. */
|
|
76
|
+
export type DeleteInput = Prettify<WithAuthorization<KeyQuorumDeleteParams>>;
|
|
77
|
+
}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { Prettify } from 'viem';
|
|
2
|
+
import { PrivyAPI } from '../../client';
|
|
3
|
+
import { generateAuthorizationSignatures } from '../../lib/authorization';
|
|
4
|
+
import {
|
|
5
|
+
Policies,
|
|
6
|
+
Policy,
|
|
7
|
+
PolicyCreateRuleParams,
|
|
8
|
+
PolicyCreateRuleResponse,
|
|
9
|
+
PolicyDeleteParams,
|
|
10
|
+
PolicyDeleteResponse,
|
|
11
|
+
PolicyDeleteRuleParams,
|
|
12
|
+
PolicyDeleteRuleResponse,
|
|
13
|
+
PolicyUpdateParams,
|
|
14
|
+
PolicyUpdateRuleParams,
|
|
15
|
+
PolicyUpdateRuleResponse,
|
|
16
|
+
} from '../../resources';
|
|
17
|
+
import { PrivyClient } from '../PrivyClient';
|
|
18
|
+
import { WithAuthorization } from './types';
|
|
19
|
+
|
|
20
|
+
export class PrivyPoliciesService extends Policies {
|
|
21
|
+
private privyClient: PrivyClient;
|
|
22
|
+
|
|
23
|
+
constructor(privyApiClient: PrivyAPI, privyClient: PrivyClient) {
|
|
24
|
+
super(privyApiClient);
|
|
25
|
+
this.privyClient = privyClient;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
public async update(
|
|
29
|
+
policyId: string,
|
|
30
|
+
{ authorization_context: authorizationContext = {}, ...params }: PrivyPoliciesService.UpdateInput,
|
|
31
|
+
): Promise<Policy> {
|
|
32
|
+
const authorizationSignaturesHeader = await generateAuthorizationSignatures(this.privyClient, {
|
|
33
|
+
authorizationContext,
|
|
34
|
+
input: {
|
|
35
|
+
version: 1,
|
|
36
|
+
method: 'PATCH',
|
|
37
|
+
url: `${this._client.baseURL}/v1/policies/${policyId}`,
|
|
38
|
+
body: params,
|
|
39
|
+
headers: {
|
|
40
|
+
'privy-app-id': this._client.appID,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const response = await this._update(policyId, {
|
|
46
|
+
...params,
|
|
47
|
+
'privy-authorization-signature': authorizationSignaturesHeader.join(','),
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
return response;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
public async delete(
|
|
54
|
+
policyId: string,
|
|
55
|
+
{ authorization_context: authorizationContext = {}, ...params }: PrivyPoliciesService.DeleteInput,
|
|
56
|
+
): Promise<PolicyDeleteResponse> {
|
|
57
|
+
const authorizationSignaturesHeader = await generateAuthorizationSignatures(this.privyClient, {
|
|
58
|
+
authorizationContext,
|
|
59
|
+
input: {
|
|
60
|
+
version: 1,
|
|
61
|
+
method: 'DELETE',
|
|
62
|
+
url: `${this._client.baseURL}/v1/policies/${policyId}`,
|
|
63
|
+
body: params,
|
|
64
|
+
headers: {
|
|
65
|
+
'privy-app-id': this._client.appID,
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const response = await this._delete(policyId, {
|
|
71
|
+
...params,
|
|
72
|
+
'privy-authorization-signature': authorizationSignaturesHeader.join(','),
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
return response;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
public async createRule(
|
|
79
|
+
policyId: string,
|
|
80
|
+
{ authorization_context: authorizationContext = {}, ...params }: PrivyPoliciesService.CreateRuleInput,
|
|
81
|
+
): Promise<PolicyCreateRuleResponse> {
|
|
82
|
+
const authorizationSignaturesHeader = await generateAuthorizationSignatures(this.privyClient, {
|
|
83
|
+
authorizationContext,
|
|
84
|
+
input: {
|
|
85
|
+
version: 1,
|
|
86
|
+
method: 'POST',
|
|
87
|
+
url: `${this._client.baseURL}/v1/policies/${policyId}/rules`,
|
|
88
|
+
body: params,
|
|
89
|
+
headers: {
|
|
90
|
+
'privy-app-id': this._client.appID,
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
const response = await this._createRule(policyId, {
|
|
96
|
+
...params,
|
|
97
|
+
'privy-authorization-signature': authorizationSignaturesHeader.join(','),
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
return response;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
public async updateRule(
|
|
104
|
+
ruleId: string,
|
|
105
|
+
{
|
|
106
|
+
authorization_context: authorizationContext = {},
|
|
107
|
+
policy_id: policyId,
|
|
108
|
+
...params
|
|
109
|
+
}: PrivyPoliciesService.UpdateRuleInput,
|
|
110
|
+
): Promise<PolicyUpdateRuleResponse> {
|
|
111
|
+
const authorizationSignaturesHeader = await generateAuthorizationSignatures(this.privyClient, {
|
|
112
|
+
authorizationContext,
|
|
113
|
+
input: {
|
|
114
|
+
version: 1,
|
|
115
|
+
method: 'PATCH',
|
|
116
|
+
url: `${this._client.baseURL}/v1/policies/${policyId}/rules/${ruleId}`,
|
|
117
|
+
body: params,
|
|
118
|
+
headers: {
|
|
119
|
+
'privy-app-id': this._client.appID,
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
const response = await this._updateRule(ruleId, {
|
|
125
|
+
...params,
|
|
126
|
+
policy_id: policyId,
|
|
127
|
+
'privy-authorization-signature': authorizationSignaturesHeader.join(','),
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
return response;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
public async deleteRule(
|
|
134
|
+
ruleId: string,
|
|
135
|
+
{
|
|
136
|
+
authorization_context: authorizationContext = {},
|
|
137
|
+
policy_id: policyId,
|
|
138
|
+
...params
|
|
139
|
+
}: PrivyPoliciesService.DeleteRuleInput,
|
|
140
|
+
): Promise<PolicyDeleteRuleResponse> {
|
|
141
|
+
const authorizationSignaturesHeader = await generateAuthorizationSignatures(this.privyClient, {
|
|
142
|
+
authorizationContext,
|
|
143
|
+
input: {
|
|
144
|
+
version: 1,
|
|
145
|
+
method: 'DELETE',
|
|
146
|
+
url: `${this._client.baseURL}/v1/policies/${policyId}/rules/${ruleId}`,
|
|
147
|
+
body: params,
|
|
148
|
+
headers: {
|
|
149
|
+
'privy-app-id': this._client.appID,
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
const response = await this._deleteRule(ruleId, {
|
|
155
|
+
...params,
|
|
156
|
+
policy_id: policyId,
|
|
157
|
+
'privy-authorization-signature': authorizationSignaturesHeader.join(','),
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
return response;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export namespace PrivyPoliciesService {
|
|
165
|
+
/** The input type for the {@link PrivyPoliciesService.update} method. */
|
|
166
|
+
export type UpdateInput = Prettify<WithAuthorization<PolicyUpdateParams>>;
|
|
167
|
+
/** The input type for the {@link PrivyPoliciesService.delete} method. */
|
|
168
|
+
export type DeleteInput = Prettify<WithAuthorization<PolicyDeleteParams>>;
|
|
169
|
+
/** The input type for the {@link PrivyPoliciesService.createRule} method. */
|
|
170
|
+
export type CreateRuleInput = Prettify<WithAuthorization<PolicyCreateRuleParams>>;
|
|
171
|
+
/** The input type for the {@link PrivyPoliciesService.updateRule} method. */
|
|
172
|
+
export type UpdateRuleInput = Prettify<WithAuthorization<PolicyUpdateRuleParams>>;
|
|
173
|
+
/** The input type for the {@link PrivyPoliciesService.deleteRule} method. */
|
|
174
|
+
export type DeleteRuleInput = Prettify<WithAuthorization<PolicyDeleteRuleParams>>;
|
|
175
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { WalletRpcParams, WalletRpcResponse } from '../../resources';
|
|
2
|
+
import { PrivyWalletsService, ReplaceParams } from './wallets';
|
|
3
|
+
import { PrivyWalletsRpcInput } from './wallets';
|
|
4
|
+
|
|
5
|
+
export class PrivySolanaService {
|
|
6
|
+
private privyWalletsService: PrivyWalletsService;
|
|
7
|
+
|
|
8
|
+
constructor(privyWalletsService: PrivyWalletsService) {
|
|
9
|
+
this.privyWalletsService = privyWalletsService;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
public async signMessage(
|
|
13
|
+
walletId: string,
|
|
14
|
+
{ message, ...input }: PrivySolanaService.SignMessageInput,
|
|
15
|
+
): Promise<WalletRpcResponse.SolanaSignMessageRpcResponse.Data> {
|
|
16
|
+
let params: WalletRpcParams.SolanaSignMessageRpcInput.Params;
|
|
17
|
+
if (message instanceof Uint8Array) {
|
|
18
|
+
// We fall back to `Buffer` here as Uint8Array.toBase64 is not widely supported yet
|
|
19
|
+
params = { message: Buffer.from(message).toString('base64'), encoding: 'base64' };
|
|
20
|
+
} else {
|
|
21
|
+
// Strings are assumed to be base64 encoded
|
|
22
|
+
params = { message, encoding: 'base64' };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const response = await this.privyWalletsService.rpc(walletId, {
|
|
26
|
+
...input,
|
|
27
|
+
method: 'signMessage',
|
|
28
|
+
chain_type: 'solana',
|
|
29
|
+
params,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
return response.data;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public async signTransaction(
|
|
36
|
+
walletId: string,
|
|
37
|
+
{ transaction, ...input }: PrivySolanaService.SignTransactionInput,
|
|
38
|
+
): Promise<WalletRpcResponse.SolanaSignTransactionRpcResponse.Data> {
|
|
39
|
+
let params: WalletRpcParams.SolanaSignTransactionRpcInput.Params;
|
|
40
|
+
if (transaction instanceof Uint8Array) {
|
|
41
|
+
// We fall back to `Buffer` here as Uint8Array.toBase64 is not widely supported yet
|
|
42
|
+
params = { transaction: Buffer.from(transaction).toString('base64'), encoding: 'base64' };
|
|
43
|
+
} else {
|
|
44
|
+
// Strings are assumed to be base64 encoded
|
|
45
|
+
params = { transaction, encoding: 'base64' };
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const response = await this.privyWalletsService.rpc(walletId, {
|
|
49
|
+
...input,
|
|
50
|
+
method: 'signTransaction',
|
|
51
|
+
chain_type: 'solana',
|
|
52
|
+
params,
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
return response.data;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
public async signAndSendTransaction(
|
|
59
|
+
walletId: string,
|
|
60
|
+
{ transaction, ...input }: PrivySolanaService.SignAndSendTransactionInput,
|
|
61
|
+
): Promise<WalletRpcResponse.SolanaSignAndSendTransactionRpcResponse.Data> {
|
|
62
|
+
let params: WalletRpcParams.SolanaSignAndSendTransactionRpcInput.Params;
|
|
63
|
+
if (transaction instanceof Uint8Array) {
|
|
64
|
+
// We fall back to `Buffer` here as Uint8Array.toBase64 is not widely supported yet
|
|
65
|
+
params = { transaction: Buffer.from(transaction).toString('base64'), encoding: 'base64' };
|
|
66
|
+
} else {
|
|
67
|
+
// Strings are assumed to be base64 encoded
|
|
68
|
+
params = { transaction, encoding: 'base64' };
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const response = await this.privyWalletsService.rpc(walletId, {
|
|
72
|
+
...input,
|
|
73
|
+
method: 'signAndSendTransaction',
|
|
74
|
+
chain_type: 'solana',
|
|
75
|
+
params,
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
if (!response.data) {
|
|
79
|
+
throw new Error(response.error?.message ?? 'Unexpected response from Privy API');
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return response.data;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// prettier-ignore
|
|
87
|
+
/**
|
|
88
|
+
* The namespace for types related to the Solana service class.
|
|
89
|
+
* @see {@link PrivySolanaService} class.
|
|
90
|
+
* @see {@link PrivyWalletsRpcInput} type.
|
|
91
|
+
*/
|
|
92
|
+
export namespace PrivySolanaService {
|
|
93
|
+
/**
|
|
94
|
+
* The input type for the {@link PrivySolanaService.signMessage} method.
|
|
95
|
+
* Instead of accepting the raw `params` object, it accepts a message `string` or `Uint8Array`
|
|
96
|
+
* that is automatically converted to the right `params` object.
|
|
97
|
+
*/
|
|
98
|
+
export type SignMessageInput = ReplaceParams<PrivyWalletsRpcInput<WalletRpcParams.SolanaSignMessageRpcInput>, {message: string | Uint8Array}>;
|
|
99
|
+
/**
|
|
100
|
+
* The input type for the {@link PrivySolanaService.signTransaction} method.
|
|
101
|
+
* Instead of accepting the raw `params` object, it accepts a transaction `string` or `Uint8Array`
|
|
102
|
+
* that is automatically converted to the right `params` object.
|
|
103
|
+
*/
|
|
104
|
+
export type SignTransactionInput = ReplaceParams<PrivyWalletsRpcInput<WalletRpcParams.SolanaSignTransactionRpcInput>, {transaction: string | Uint8Array}>;
|
|
105
|
+
/**
|
|
106
|
+
* The input type for the {@link PrivySolanaService.signAndSendTransaction} method.
|
|
107
|
+
* Instead of accepting the raw `params` object, it accepts a transaction `string` or `Uint8Array`
|
|
108
|
+
* that is automatically converted to the right `params` object.
|
|
109
|
+
*/
|
|
110
|
+
export type SignAndSendTransactionInput = ReplaceParams<PrivyWalletsRpcInput<WalletRpcParams.SolanaSignAndSendTransactionRpcInput>, {transaction: string | Uint8Array}>;
|
|
111
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { AuthorizationContext } from '../../lib/authorization';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Configuration object that can be set by the caller and is used to generate the right value for
|
|
5
|
+
* the `privy-authorization-signature` HTTP header.
|
|
6
|
+
*/
|
|
7
|
+
export type AuthorizationConfig = { authorization_context?: AuthorizationContext };
|
|
8
|
+
type AuthParams = { 'privy-authorization-signature'?: any };
|
|
9
|
+
// prettier-ignore
|
|
10
|
+
/**
|
|
11
|
+
* Helper type that takes a parameters object (body & headers of an API request) and replaces the
|
|
12
|
+
* `privy-authorization-signature` HTTP header with the authorization config object.
|
|
13
|
+
*
|
|
14
|
+
* This is used to turn Params objects that accept the raw header value into ones that accept the
|
|
15
|
+
* more ergonomic config object instead.
|
|
16
|
+
*/
|
|
17
|
+
export type WithAuthorization<Params extends AuthParams> =
|
|
18
|
+
TheOmit<Params, keyof AuthParams> & AuthorizationConfig;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Configuration object that can be set by the caller and is used to generate the right value for
|
|
22
|
+
* the `privy-idempotency-key` HTTP header.
|
|
23
|
+
*/
|
|
24
|
+
export type IdempotencyConfig = { idempotency_key?: string };
|
|
25
|
+
type IdempotencyParams = { 'privy-idempotency-key'?: any };
|
|
26
|
+
// prettier-ignore
|
|
27
|
+
/**
|
|
28
|
+
* Helper type that takes a parameters object (body & headers of an API request) and replaces
|
|
29
|
+
* the `privy-idempotency-key` HTTP header with the idempotency config object.
|
|
30
|
+
*
|
|
31
|
+
* This is used to turn Params objects that accept the raw header value into ones that accept the
|
|
32
|
+
* more ergonomic config object instead.
|
|
33
|
+
*/
|
|
34
|
+
export type WithIdempotency<Params extends IdempotencyParams> =
|
|
35
|
+
TheOmit<Params, keyof IdempotencyParams> & IdempotencyConfig;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* `Omit` loses type info in unions like the `WalletRpcParams` type.
|
|
39
|
+
* @see https://github.com/microsoft/TypeScript/issues/54525
|
|
40
|
+
*/
|
|
41
|
+
type TheOmit<T, K extends keyof T> = { [P in keyof T as P extends K ? never : P]: T[P] };
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Utility type that takes an object type and makes the hover overlay more readable.
|
|
45
|
+
*
|
|
46
|
+
* [Learn more](https://www.totaltypescript.com/concepts/the-prettify-helper)
|
|
47
|
+
*/
|
|
48
|
+
export type Prettify<T> = {
|
|
49
|
+
[K in keyof T]: T[K];
|
|
50
|
+
} & {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import {
|
|
2
|
+
formatRequestForAuthorizationSignature,
|
|
3
|
+
generateAuthorizationSignature,
|
|
4
|
+
generateAuthorizationSignatures,
|
|
5
|
+
} from '../../lib/authorization';
|
|
6
|
+
import { PrivyClient } from '../PrivyClient';
|
|
7
|
+
|
|
8
|
+
export class PrivyUtils {
|
|
9
|
+
private privyClient: PrivyClient;
|
|
10
|
+
|
|
11
|
+
constructor(privyClient: PrivyClient) {
|
|
12
|
+
this.privyClient = privyClient;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Expose these as methods here for convenience
|
|
16
|
+
public formatRequestForAuthorizationSignature = formatRequestForAuthorizationSignature;
|
|
17
|
+
public generateAuthorizationSignature = generateAuthorizationSignature;
|
|
18
|
+
public generateAuthorizationSignatures(...input: PrivyUtils.GenerateAuthorizationSignaturesInput) {
|
|
19
|
+
// Pre-populates the client instance for the function
|
|
20
|
+
return generateAuthorizationSignatures(this.privyClient, ...input);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// prettier-ignore
|
|
25
|
+
export namespace PrivyUtils {
|
|
26
|
+
export type GenerateAuthorizationSignaturesInput = ParametersExceptFirst<typeof generateAuthorizationSignatures>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Utility type similar to `Parameters` but excluding the first argument.
|
|
31
|
+
* This is used to get the types of the remaining arguments of a function, excluding the first one.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* type MyFunction = (arg0: string, arg1: number, arg2: boolean) => any;
|
|
36
|
+
* type MyFunctionParameters = ParametersExceptFirst<MyFunction>;
|
|
37
|
+
* // type MyFunctionParameters = [number, boolean]
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
type ParametersExceptFirst<F> = F extends (arg0: any, ...rest: infer R) => any ? R : never;
|