@farcaster/hub-web 0.6.6 → 0.6.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +499 -104
- package/dist/index.js +37 -7
- package/dist/index.mjs +44 -14
- package/package.json +3 -4
package/dist/index.js
CHANGED
@@ -2698,7 +2698,7 @@ __reExport(src_exports, require("@farcaster/core"), module.exports);
|
|
2698
2698
|
|
2699
2699
|
// src/generated/rpc.ts
|
2700
2700
|
init_cjs_shims();
|
2701
|
-
var import_grpc_web = require("@improbable-eng/grpc-web");
|
2701
|
+
var import_grpc_web = __toESM(require("@improbable-eng/grpc-web"));
|
2702
2702
|
var import_browser_headers = __toESM(require_browser_headers());
|
2703
2703
|
var import_rxjs = require("rxjs");
|
2704
2704
|
var import_operators = require("rxjs/operators");
|
@@ -3925,7 +3925,13 @@ var ReactionBody = {
|
|
3925
3925
|
}
|
3926
3926
|
};
|
3927
3927
|
function createBaseVerificationAddEthAddressBody() {
|
3928
|
-
return {
|
3928
|
+
return {
|
3929
|
+
address: new Uint8Array(),
|
3930
|
+
ethSignature: new Uint8Array(),
|
3931
|
+
blockHash: new Uint8Array(),
|
3932
|
+
verificationType: 0,
|
3933
|
+
chainId: 0
|
3934
|
+
};
|
3929
3935
|
}
|
3930
3936
|
var VerificationAddEthAddressBody = {
|
3931
3937
|
encode(message, writer = import_minimal2.default.Writer.create()) {
|
@@ -3938,6 +3944,12 @@ var VerificationAddEthAddressBody = {
|
|
3938
3944
|
if (message.blockHash.length !== 0) {
|
3939
3945
|
writer.uint32(26).bytes(message.blockHash);
|
3940
3946
|
}
|
3947
|
+
if (message.verificationType !== 0) {
|
3948
|
+
writer.uint32(32).uint32(message.verificationType);
|
3949
|
+
}
|
3950
|
+
if (message.chainId !== 0) {
|
3951
|
+
writer.uint32(40).uint32(message.chainId);
|
3952
|
+
}
|
3941
3953
|
return writer;
|
3942
3954
|
},
|
3943
3955
|
decode(input, length) {
|
@@ -3965,6 +3977,18 @@ var VerificationAddEthAddressBody = {
|
|
3965
3977
|
}
|
3966
3978
|
message.blockHash = reader.bytes();
|
3967
3979
|
continue;
|
3980
|
+
case 4:
|
3981
|
+
if (tag != 32) {
|
3982
|
+
break;
|
3983
|
+
}
|
3984
|
+
message.verificationType = reader.uint32();
|
3985
|
+
continue;
|
3986
|
+
case 5:
|
3987
|
+
if (tag != 40) {
|
3988
|
+
break;
|
3989
|
+
}
|
3990
|
+
message.chainId = reader.uint32();
|
3991
|
+
continue;
|
3968
3992
|
}
|
3969
3993
|
if ((tag & 7) == 4 || tag == 0) {
|
3970
3994
|
break;
|
@@ -3977,7 +4001,9 @@ var VerificationAddEthAddressBody = {
|
|
3977
4001
|
return {
|
3978
4002
|
address: isSet2(object.address) ? bytesFromBase642(object.address) : new Uint8Array(),
|
3979
4003
|
ethSignature: isSet2(object.ethSignature) ? bytesFromBase642(object.ethSignature) : new Uint8Array(),
|
3980
|
-
blockHash: isSet2(object.blockHash) ? bytesFromBase642(object.blockHash) : new Uint8Array()
|
4004
|
+
blockHash: isSet2(object.blockHash) ? bytesFromBase642(object.blockHash) : new Uint8Array(),
|
4005
|
+
verificationType: isSet2(object.verificationType) ? Number(object.verificationType) : 0,
|
4006
|
+
chainId: isSet2(object.chainId) ? Number(object.chainId) : 0
|
3981
4007
|
};
|
3982
4008
|
},
|
3983
4009
|
toJSON(message) {
|
@@ -3987,17 +4013,21 @@ var VerificationAddEthAddressBody = {
|
|
3987
4013
|
message.ethSignature !== void 0 ? message.ethSignature : new Uint8Array()
|
3988
4014
|
));
|
3989
4015
|
message.blockHash !== void 0 && (obj.blockHash = base64FromBytes2(message.blockHash !== void 0 ? message.blockHash : new Uint8Array()));
|
4016
|
+
message.verificationType !== void 0 && (obj.verificationType = Math.round(message.verificationType));
|
4017
|
+
message.chainId !== void 0 && (obj.chainId = Math.round(message.chainId));
|
3990
4018
|
return obj;
|
3991
4019
|
},
|
3992
4020
|
create(base) {
|
3993
4021
|
return VerificationAddEthAddressBody.fromPartial(base != null ? base : {});
|
3994
4022
|
},
|
3995
4023
|
fromPartial(object) {
|
3996
|
-
var _a, _b, _c;
|
4024
|
+
var _a, _b, _c, _d, _e;
|
3997
4025
|
const message = createBaseVerificationAddEthAddressBody();
|
3998
4026
|
message.address = (_a = object.address) != null ? _a : new Uint8Array();
|
3999
4027
|
message.ethSignature = (_b = object.ethSignature) != null ? _b : new Uint8Array();
|
4000
4028
|
message.blockHash = (_c = object.blockHash) != null ? _c : new Uint8Array();
|
4029
|
+
message.verificationType = (_d = object.verificationType) != null ? _d : 0;
|
4030
|
+
message.chainId = (_e = object.chainId) != null ? _e : 0;
|
4001
4031
|
return message;
|
4002
4032
|
}
|
4003
4033
|
};
|
@@ -9157,14 +9187,14 @@ var GrpcWebImpl = class {
|
|
9157
9187
|
const request = { ..._request, ...methodDesc.requestType };
|
9158
9188
|
const maybeCombinedMetadata = metadata && this.options.metadata ? new import_browser_headers.BrowserHeaders({ ...(_a = this.options) == null ? void 0 : _a.metadata.headersMap, ...metadata == null ? void 0 : metadata.headersMap }) : metadata || this.options.metadata;
|
9159
9189
|
return new Promise((resolve, reject) => {
|
9160
|
-
import_grpc_web.grpc.unary(methodDesc, {
|
9190
|
+
import_grpc_web.default.grpc.unary(methodDesc, {
|
9161
9191
|
request,
|
9162
9192
|
host: this.host,
|
9163
9193
|
metadata: maybeCombinedMetadata,
|
9164
9194
|
transport: this.options.transport,
|
9165
9195
|
debug: this.options.debug,
|
9166
9196
|
onEnd: function(response) {
|
9167
|
-
if (response.status === import_grpc_web.grpc.Code.OK) {
|
9197
|
+
if (response.status === import_grpc_web.default.grpc.Code.OK) {
|
9168
9198
|
resolve(response.message.toObject());
|
9169
9199
|
} else {
|
9170
9200
|
const err2 = new GrpcWebError(response.statusMessage, response.status, response.trailers);
|
@@ -9182,7 +9212,7 @@ var GrpcWebImpl = class {
|
|
9182
9212
|
const maybeCombinedMetadata = metadata && this.options.metadata ? new import_browser_headers.BrowserHeaders({ ...(_a = this.options) == null ? void 0 : _a.metadata.headersMap, ...metadata == null ? void 0 : metadata.headersMap }) : metadata || this.options.metadata;
|
9183
9213
|
return new import_rxjs.Observable((observer) => {
|
9184
9214
|
const upStream = () => {
|
9185
|
-
const client = import_grpc_web.grpc.invoke(methodDesc, {
|
9215
|
+
const client = import_grpc_web.default.grpc.invoke(methodDesc, {
|
9186
9216
|
host: this.host,
|
9187
9217
|
request,
|
9188
9218
|
transport: this.options.streamingTransport || this.options.transport,
|
package/dist/index.mjs
CHANGED
@@ -2637,7 +2637,7 @@ export * from "@farcaster/core";
|
|
2637
2637
|
// src/generated/rpc.ts
|
2638
2638
|
init_esm_shims();
|
2639
2639
|
var import_browser_headers = __toESM(require_browser_headers());
|
2640
|
-
import
|
2640
|
+
import grpcWeb from "@improbable-eng/grpc-web";
|
2641
2641
|
import { Observable } from "rxjs";
|
2642
2642
|
import { share } from "rxjs/operators";
|
2643
2643
|
|
@@ -3863,7 +3863,13 @@ var ReactionBody = {
|
|
3863
3863
|
}
|
3864
3864
|
};
|
3865
3865
|
function createBaseVerificationAddEthAddressBody() {
|
3866
|
-
return {
|
3866
|
+
return {
|
3867
|
+
address: new Uint8Array(),
|
3868
|
+
ethSignature: new Uint8Array(),
|
3869
|
+
blockHash: new Uint8Array(),
|
3870
|
+
verificationType: 0,
|
3871
|
+
chainId: 0
|
3872
|
+
};
|
3867
3873
|
}
|
3868
3874
|
var VerificationAddEthAddressBody = {
|
3869
3875
|
encode(message, writer = import_minimal2.default.Writer.create()) {
|
@@ -3876,6 +3882,12 @@ var VerificationAddEthAddressBody = {
|
|
3876
3882
|
if (message.blockHash.length !== 0) {
|
3877
3883
|
writer.uint32(26).bytes(message.blockHash);
|
3878
3884
|
}
|
3885
|
+
if (message.verificationType !== 0) {
|
3886
|
+
writer.uint32(32).uint32(message.verificationType);
|
3887
|
+
}
|
3888
|
+
if (message.chainId !== 0) {
|
3889
|
+
writer.uint32(40).uint32(message.chainId);
|
3890
|
+
}
|
3879
3891
|
return writer;
|
3880
3892
|
},
|
3881
3893
|
decode(input, length) {
|
@@ -3903,6 +3915,18 @@ var VerificationAddEthAddressBody = {
|
|
3903
3915
|
}
|
3904
3916
|
message.blockHash = reader.bytes();
|
3905
3917
|
continue;
|
3918
|
+
case 4:
|
3919
|
+
if (tag != 32) {
|
3920
|
+
break;
|
3921
|
+
}
|
3922
|
+
message.verificationType = reader.uint32();
|
3923
|
+
continue;
|
3924
|
+
case 5:
|
3925
|
+
if (tag != 40) {
|
3926
|
+
break;
|
3927
|
+
}
|
3928
|
+
message.chainId = reader.uint32();
|
3929
|
+
continue;
|
3906
3930
|
}
|
3907
3931
|
if ((tag & 7) == 4 || tag == 0) {
|
3908
3932
|
break;
|
@@ -3915,7 +3939,9 @@ var VerificationAddEthAddressBody = {
|
|
3915
3939
|
return {
|
3916
3940
|
address: isSet2(object.address) ? bytesFromBase642(object.address) : new Uint8Array(),
|
3917
3941
|
ethSignature: isSet2(object.ethSignature) ? bytesFromBase642(object.ethSignature) : new Uint8Array(),
|
3918
|
-
blockHash: isSet2(object.blockHash) ? bytesFromBase642(object.blockHash) : new Uint8Array()
|
3942
|
+
blockHash: isSet2(object.blockHash) ? bytesFromBase642(object.blockHash) : new Uint8Array(),
|
3943
|
+
verificationType: isSet2(object.verificationType) ? Number(object.verificationType) : 0,
|
3944
|
+
chainId: isSet2(object.chainId) ? Number(object.chainId) : 0
|
3919
3945
|
};
|
3920
3946
|
},
|
3921
3947
|
toJSON(message) {
|
@@ -3925,17 +3951,21 @@ var VerificationAddEthAddressBody = {
|
|
3925
3951
|
message.ethSignature !== void 0 ? message.ethSignature : new Uint8Array()
|
3926
3952
|
));
|
3927
3953
|
message.blockHash !== void 0 && (obj.blockHash = base64FromBytes2(message.blockHash !== void 0 ? message.blockHash : new Uint8Array()));
|
3954
|
+
message.verificationType !== void 0 && (obj.verificationType = Math.round(message.verificationType));
|
3955
|
+
message.chainId !== void 0 && (obj.chainId = Math.round(message.chainId));
|
3928
3956
|
return obj;
|
3929
3957
|
},
|
3930
3958
|
create(base) {
|
3931
3959
|
return VerificationAddEthAddressBody.fromPartial(base != null ? base : {});
|
3932
3960
|
},
|
3933
3961
|
fromPartial(object) {
|
3934
|
-
var _a, _b, _c;
|
3962
|
+
var _a, _b, _c, _d, _e;
|
3935
3963
|
const message = createBaseVerificationAddEthAddressBody();
|
3936
3964
|
message.address = (_a = object.address) != null ? _a : new Uint8Array();
|
3937
3965
|
message.ethSignature = (_b = object.ethSignature) != null ? _b : new Uint8Array();
|
3938
3966
|
message.blockHash = (_c = object.blockHash) != null ? _c : new Uint8Array();
|
3967
|
+
message.verificationType = (_d = object.verificationType) != null ? _d : 0;
|
3968
|
+
message.chainId = (_e = object.chainId) != null ? _e : 0;
|
3939
3969
|
return message;
|
3940
3970
|
}
|
3941
3971
|
};
|
@@ -9095,14 +9125,14 @@ var GrpcWebImpl = class {
|
|
9095
9125
|
const request = { ..._request, ...methodDesc.requestType };
|
9096
9126
|
const maybeCombinedMetadata = metadata && this.options.metadata ? new import_browser_headers.BrowserHeaders({ ...(_a = this.options) == null ? void 0 : _a.metadata.headersMap, ...metadata == null ? void 0 : metadata.headersMap }) : metadata || this.options.metadata;
|
9097
9127
|
return new Promise((resolve, reject) => {
|
9098
|
-
grpc.unary(methodDesc, {
|
9128
|
+
grpcWeb.grpc.unary(methodDesc, {
|
9099
9129
|
request,
|
9100
9130
|
host: this.host,
|
9101
9131
|
metadata: maybeCombinedMetadata,
|
9102
9132
|
transport: this.options.transport,
|
9103
9133
|
debug: this.options.debug,
|
9104
9134
|
onEnd: function(response) {
|
9105
|
-
if (response.status === grpc.Code.OK) {
|
9135
|
+
if (response.status === grpcWeb.grpc.Code.OK) {
|
9106
9136
|
resolve(response.message.toObject());
|
9107
9137
|
} else {
|
9108
9138
|
const err2 = new GrpcWebError(response.statusMessage, response.status, response.trailers);
|
@@ -9120,7 +9150,7 @@ var GrpcWebImpl = class {
|
|
9120
9150
|
const maybeCombinedMetadata = metadata && this.options.metadata ? new import_browser_headers.BrowserHeaders({ ...(_a = this.options) == null ? void 0 : _a.metadata.headersMap, ...metadata == null ? void 0 : metadata.headersMap }) : metadata || this.options.metadata;
|
9121
9151
|
return new Observable((observer) => {
|
9122
9152
|
const upStream = () => {
|
9123
|
-
const client = grpc.invoke(methodDesc, {
|
9153
|
+
const client = grpcWeb.grpc.invoke(methodDesc, {
|
9124
9154
|
host: this.host,
|
9125
9155
|
request,
|
9126
9156
|
transport: this.options.streamingTransport || this.options.transport,
|
@@ -9175,7 +9205,7 @@ var GrpcWebError = class extends tsProtoGlobalThis6.Error {
|
|
9175
9205
|
|
9176
9206
|
// src/client.ts
|
9177
9207
|
init_esm_shims();
|
9178
|
-
import
|
9208
|
+
import grpcWeb2 from "@improbable-eng/grpc-web";
|
9179
9209
|
|
9180
9210
|
// ../../node_modules/neverthrow/dist/index.es.js
|
9181
9211
|
init_esm_shims();
|
@@ -9588,15 +9618,15 @@ import { HubError } from "@farcaster/core";
|
|
9588
9618
|
import { Observable as Observable2 } from "rxjs";
|
9589
9619
|
var grpcCodeToHubErrorCode = (code) => {
|
9590
9620
|
switch (code) {
|
9591
|
-
case
|
9621
|
+
case grpcWeb2.grpc.Code.Unauthenticated:
|
9592
9622
|
return "unauthenticated";
|
9593
|
-
case
|
9623
|
+
case grpcWeb2.grpc.Code.PermissionDenied:
|
9594
9624
|
return "unauthorized";
|
9595
|
-
case
|
9625
|
+
case grpcWeb2.grpc.Code.InvalidArgument:
|
9596
9626
|
return "bad_request";
|
9597
|
-
case
|
9627
|
+
case grpcWeb2.grpc.Code.NotFound:
|
9598
9628
|
return "not_found";
|
9599
|
-
case
|
9629
|
+
case grpcWeb2.grpc.Code.Unavailable:
|
9600
9630
|
return "unavailable";
|
9601
9631
|
default:
|
9602
9632
|
return "unknown";
|
@@ -9644,7 +9674,7 @@ var getRpcWebClient = (...args) => {
|
|
9644
9674
|
return new GrpcWebImpl(...args);
|
9645
9675
|
};
|
9646
9676
|
var getAuthMetadata = (username, password) => {
|
9647
|
-
const metadata = new
|
9677
|
+
const metadata = new grpcWeb2.grpc.Metadata();
|
9648
9678
|
if (typeof btoa === "undefined") {
|
9649
9679
|
metadata.set("authorization", `Basic ${Buffer.from(`${username}:${password}`).toString("base64")}`);
|
9650
9680
|
} else {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@farcaster/hub-web",
|
3
|
-
"version": "0.6.
|
3
|
+
"version": "0.6.8",
|
4
4
|
"main": "./dist/index.js",
|
5
5
|
"module": "./dist/index.mjs",
|
6
6
|
"types": "./dist/index.d.ts",
|
@@ -18,18 +18,17 @@
|
|
18
18
|
"scripts": {
|
19
19
|
"build": "tsup --config tsup.config.ts",
|
20
20
|
"clean": "rimraf ./dist",
|
21
|
-
"protoc": "docker run --rm -v $(pwd)/../../node_modules:/node_modules -v $(pwd)/../../protobufs/schemas:/defs -v $(pwd)/src/generated:/out namely/protoc:1.50_1 --plugin=/node_modules/ts-proto/protoc-gen-ts_proto --ts_proto_out=/out --ts_proto_opt=esModuleInterop=true,exportCommonSymbols=false,outputClientImpl=grpc-web,useOptionals=none,unrecognizedEnum=false,removeEnumPrefix=true,lowerCaseServiceMethods=true --proto_path=/defs /defs/rpc.proto",
|
21
|
+
"protoc": "docker run --rm --user $(id -u):$(id -g) -v $(pwd)/../../node_modules:/node_modules -v $(pwd)/../../protobufs/schemas:/defs -v $(pwd)/src/generated:/out namely/protoc:1.50_1 --plugin=/node_modules/ts-proto/protoc-gen-ts_proto --ts_proto_out=/out --ts_proto_opt=esModuleInterop=true,exportCommonSymbols=false,outputClientImpl=grpc-web,useOptionals=none,unrecognizedEnum=false,removeEnumPrefix=true,lowerCaseServiceMethods=true --proto_path=/defs /defs/rpc.proto",
|
22
22
|
"lint": "biome format src/ examples/ --write && biome check src/ examples/ --apply",
|
23
23
|
"lint:ci": "biome ci src/ examples/",
|
24
24
|
"prepublishOnly": "yarn run build"
|
25
25
|
},
|
26
26
|
"devDependencies": {
|
27
27
|
"biome-config-custom": "*",
|
28
|
-
"eslint-config-custom": "*",
|
29
28
|
"ts-proto": "^1.146.0"
|
30
29
|
},
|
31
30
|
"dependencies": {
|
32
|
-
"@farcaster/core": "^0.12.
|
31
|
+
"@farcaster/core": "^0.12.13",
|
33
32
|
"@improbable-eng/grpc-web": "^0.15.0",
|
34
33
|
"rxjs": "^7.8.0"
|
35
34
|
}
|